//Analog Pin definition
#define analog0 A0
#define analog1 A1
#define analog2 A2
//Digital Pin definition
#define led0 2
#define led1 3
#define led2 4
int statoLed0 = 0;
int statoLed1 = 0;
int statoLed2 = 0;
void setup() {
pinMode( analog0, INPUT );
pinMode( analog1, INPUT );
pinMode( analog2, INPUT );
pinMode( led0, OUTPUT );
pinMode( led1, OUTPUT );
pinMode( led2, OUTPUT );
digitalWrite( led0, statoLed0 );
digitalWrite( led1, statoLed1 );
digitalWrite( led2, statoLed2 );
}
void loop() {
// put your main code here, to run repeatedly:
if ( analogRead(analog0) > 1000 )
{
if ( statoLed0 == LOW ) statoLed0 = HIGH;
else statoLed0 = LOW;
digitalWrite( led0, statoLed0 );
delay(200);
}
if ( analogRead(analog1) > 1000 )
{
if ( statoLed1 == LOW ) statoLed1 = HIGH;
else statoLed1 = LOW;
digitalWrite( led1, statoLed1 );
delay(200);
}
if ( analogRead(analog2) > 1000 )
{
if ( statoLed2 == LOW ) statoLed2 = HIGH;
else statoLed2 = LOW;
digitalWrite( led2, statoLed2 );
delay(200);
}
}