int led = 10;
int sw1 = 5;
int sw2 = 6;
String a;
void setup()
{
pinMode(led, OUTPUT);
pinMode(sw1, INPUT);
pinMode(sw2, INPUT);
Serial.begin(9600);
}
void loop()
{
int push1 = digitalRead(sw1);
int push2 = digitalRead(sw2);
if (push1 == 1)
{
a += "h";
delay(1000);
Serial.println(a);
}
if (push2 ==1)
{
a += "i";
delay(1000);
Serial.println(a);
}
if (a.length() >= 2)
{
if (a=="hi")
{
digitalWrite(led, HIGH);
delay(1000);
Serial.println(a);
Serial.println(a.length());
}
else
{
digitalWrite(led, LOW);
delay(1000);
Serial.println(a);
Serial.println(a.length());
}
}
}