Vous êtes sur la page 1sur 1

const int capteur_infrarouge = A0; // the number of the 'capteur_infrarouge' pin

const int floteur=A1;


const int Electrovanne = 4; // the number of the 'Electrovanne' pin
const int LED=2;
// variables will change:
int capteur = 0;
int niveau=0;

void setup() {
// put your setup code here, to run once:
pinMode(capteur_infrarouge,INPUT);//entree du capteur de proximité
pinMode(floteur,INPUT);//entree du capteur de niveau bas
pinMode(Electrovanne,OUTPUT);//Dlectrovanne
pinMode(LED,OUTPUT);//

void loop() {
// read the state of the pushbutton value:
//

capteur = digitalRead(capteur_infrarouge);
niveau = digitalRead(floteur);
// put your main code here, to run repeatedly:

digitalWrite(LED,LOW);
if((capteur==LOW)&&(niveau==HIGH))//lecture du capteur(presence mains )
{
digitalWrite(Electrovanne,HIGH); // marche Electrovanne
}
else
{
digitalWrite(Electrovanne,LOW); //arrêt Electrovanne
}
if(niveau==LOW){
digitalWrite(LED,HIGH);
}
else
{
digitalWrite(LED,LOW);
}
}

Vous aimerez peut-être aussi