Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
int _ABVAR_1_v1 = 0 ;
int _ABVAR_2_v2 = 0 ;
int _ABVAR_3_v3 = 0 ;
void setup()
{
pinMode( 10, INPUT);
pinMode( 9, INPUT);
pinMode( 11, INPUT);
Serial.begin(9600);
pinMode( 3 , OUTPUT);
pinMode( 4 , OUTPUT);
pinMode( 5 , OUTPUT);
_ABVAR_1_v1 = 0 ;
_ABVAR_2_v2 = 0 ;
_ABVAR_3_v3 = 0 ;
}
void loop()
{
if (( digitalRead(9) && ( ( _ABVAR_1_v1 ) == ( 0 ) ) ))
{
Serial.print("v1 on");
Serial.println();
digitalWrite( 3 , HIGH );
_ABVAR_1_v1 = 1 ;
delay( 2000 );
}
if (( digitalRead(10) && ( ( _ABVAR_2_v2 ) == ( 0 ) ) ))
{
Serial.print("v2 on");
Serial.println();
digitalWrite( 4 , HIGH );
_ABVAR_2_v2 = 1 ;
delay( 2000 );
}
if (( digitalRead(11) && ( ( _ABVAR_3_v3 ) == ( 0 ) ) ))
{
Serial.print("v3 on");
Serial.println();
digitalWrite( 5 , HIGH );
_ABVAR_3_v3 = 1 ;
delay( 2000 );
}
if (( digitalRead(9) && ( ( _ABVAR_1_v1 ) == ( 1 ) ) ))
{
Serial.print("v1 off");
Serial.println();
digitalWrite( 3 , LOW );
_ABVAR_1_v1 = 0 ;
delay( 2000 );
}
if (( digitalRead(10) && ( ( _ABVAR_2_v2 ) == ( 1 ) ) ))
{
Serial.print("v2 off");
Serial.println();
digitalWrite( 4 , LOW );
_ABVAR_2_v2 = 0 ;
delay( 2000 );
}
if (( digitalRead(11) && ( ( _ABVAR_3_v3 ) == ( 1 ) ) ))
{
Serial.print("v3 off");
Serial.println();
digitalWrite( 5 , LOW );
_ABVAR_3_v3 = 0 ;
delay( 2000 );
}
}
void setup()
{
pinMode( 10, INPUT);
pinMode( 9, INPUT);
pinMode( 11, INPUT);
pinMode( 3 , OUTPUT);
pinMode( 4 , OUTPUT);
pinMode( 5 , OUTPUT);
}
void loop()
{
if (digitalRead(9))
{
digitalWrite( 3 , HIGH );
}
else
{
digitalWrite( 3 , LOW );
}
if (digitalRead(10))
{
digitalWrite( 4 , HIGH );
}
else
{
digitalWrite( 4 , LOW );
}
if (digitalRead(11))
{
digitalWrite( 5 , HIGH );
}
else
{
digitalWrite( 5 , LOW );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.