ENIB 2020 : Patator 117 : Différence entre versions

De Les Fabriques du Ponant
Aller à : navigation, rechercher
(Liste des composants)
(Code)
Ligne 15 : Ligne 15 :
 
Colle
 
Colle
  
==Code==
+
3 boutons : patate, gaz, allumage
<pre>
+
On met la patate on appuie sur le bouton : led jaune on met le gaz on appuie : led rouge on allume on appuie : led verte
ici je pose mon code documenté !
+
Les leds s’allument quand les composants sont présents
</pre>
+
 
 +
 
 +
const int ledPinV = 13;
 +
const int ledPinR = 12;
 +
const int ledPinJ = 14;
 +
const int allumage = 15;
 +
const int bpPinGaz = 0;
 +
const int bpPinPatate = 4;
 +
const int bpPinAllumage = 5;
 +
int value1 = 0;
 +
int value2 = 0;
 +
int value3 = 0;
 +
int Jallumer=0;
 +
int Rallumer=0;
 +
int Vallumer=0;
 +
void setup() {
 +
  // put your setup code here, to run once:
 +
  Serial.begin(9600);
 +
  pinMode(ledPinV, OUTPUT);
 +
  pinMode(ledPinR, OUTPUT);
 +
  pinMode(ledPinJ, OUTPUT);
 +
  pinMode(allumage, OUTPUT);
 +
  pinMode(bpPinGaz, INPUT);
 +
  pinMode(bpPinPatate, INPUT);
 +
  pinMode(bpPinAllumage, INPUT);
 +
  digitalWrite(ledPinV,LOW);
 +
digitalWrite(ledPinR,LOW);
 +
digitalWrite(ledPinJ,LOW);
 +
}
 +
 
 +
void loop() {
 +
  // put your main code here, to run repeatedly:
 +
 
 +
if(digitalRead(bpPinPatate)==HIGH)
 +
{
 +
  digitalWrite(ledPinJ,HIGH);
 +
  Jallumer=1;
 +
}
 +
Serial.println(digitalRead(bpPinPatate));
 +
if(digitalRead(bpPinGaz)==HIGH and Jallumer==1)
 +
{
 +
  digitalWrite(ledPinR,HIGH);
 +
  Rallumer=1;
 +
  }
 +
  if(digitalRead(bpPinAllumage)==HIGH and Jallumer==1 and Rallumer==1)
 +
{
 +
  digitalWrite(ledPinV,HIGH);
 +
  Vallumer=1;
 +
  }
 +
  if(Vallumer==1 and Rallumer==1 and Jallumer==1)
 +
  {
 +
    delay(3000);
 +
    digitalWrite(ledPinR,LOW);
 +
    digitalWrite(ledPinV,LOW);
 +
    digitalWrite(ledPinJ,LOW);
 +
  }
 +
}
  
 
==Catégories==
 
==Catégories==
  
 
[[Catégorie:Enib2020]]
 
[[Catégorie:Enib2020]]

Version du 17 janvier 2020 à 15:54

photo de l'équipe

Photoenib2018.jpg


Patator : Projette des patates. On met du gaz dans une chambre à combustion reliée à un tube en pvc où on a introduit une patate et on allume une source de chaleur pour créer une pression obtenue grâce à la combustion du gaz qui expulsera la patate.

carte wemos 3 leds 3 boutons poussoir Câbles Tube en pvc Conserves Gaz Allume feu Colle

3 boutons : patate, gaz, allumage On met la patate on appuie sur le bouton : led jaune on met le gaz on appuie : led rouge on allume on appuie : led verte Les leds s’allument quand les composants sont présents


const int ledPinV = 13; const int ledPinR = 12; const int ledPinJ = 14; const int allumage = 15; const int bpPinGaz = 0; const int bpPinPatate = 4; const int bpPinAllumage = 5; int value1 = 0; int value2 = 0; int value3 = 0; int Jallumer=0; int Rallumer=0; int Vallumer=0; void setup() {

 // put your setup code here, to run once:
 Serial.begin(9600);
 pinMode(ledPinV, OUTPUT);
 pinMode(ledPinR, OUTPUT);
 pinMode(ledPinJ, OUTPUT);
 pinMode(allumage, OUTPUT);
 pinMode(bpPinGaz, INPUT);
 pinMode(bpPinPatate, INPUT);
 pinMode(bpPinAllumage, INPUT);
  digitalWrite(ledPinV,LOW);
digitalWrite(ledPinR,LOW);
digitalWrite(ledPinJ,LOW);

}

void loop() {

 // put your main code here, to run repeatedly:
if(digitalRead(bpPinPatate)==HIGH)
{
 digitalWrite(ledPinJ,HIGH);
 Jallumer=1;
}
Serial.println(digitalRead(bpPinPatate));
if(digitalRead(bpPinGaz)==HIGH and Jallumer==1)
{
 digitalWrite(ledPinR,HIGH);
 Rallumer=1;
 }
 if(digitalRead(bpPinAllumage)==HIGH and Jallumer==1 and Rallumer==1)
{
 digitalWrite(ledPinV,HIGH);
 Vallumer=1;
 }
 if(Vallumer==1 and Rallumer==1 and Jallumer==1)
 {
   delay(3000);
   digitalWrite(ledPinR,LOW);
   digitalWrite(ledPinV,LOW);
   digitalWrite(ledPinJ,LOW);
 }
}

Catégories