When your finished the code down below try this!
.Add a button to pin 12
.Then add this to the code;
\\Start by adding the variable
int button = 12; // switch is on pin 12
\\Then set the input and output functions!
pinMode(button, INPUT); digitalWrite(green, HIGH);
\\And change the entire loop function to this
void loop() { if (digitalRead(button) == HIGH){ delay(15); // software debounce if (digitalRead(button) == HIGH) { // if the switch is HIGH, ie. pushed down - change the lights! changeLights(); delay(15000); // wait for 15 seconds } } }



_ztBMuBhMHo.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)









Comments