Hi
my name is Tarek
i am new to arduino and i have a problem
first of all here is the code
String value = "RED";
int pushButton = 2;
void setup() {
Serial.begin(9600);
pinMode(pushButton, INPUT);
}
void loop()
int buttonState = digitalRead(pushButton);
if (buttonState == HIGH){
if (value == "RED"){
value = "GREEN";
}else if (value == "GREEN"){
value = "BLUE";
}else if(value == "BLUE") {
value = "RED";
}
}
Serial.println(value);
}
so i want the button to change between the values but when i press the button it get crazy how can i fix that i know the problem and it is the value changes alot while i am pressing but how can fix this