In the setup, I state the functions and statements that will be executed once. I declare the buttonPin to be an output source and I add a function that assigns the pinNumber variable to be an output source if it is higher than 9(which means I will be using pins 9 and up).
Next, in the void loop, where actions are to be executed in a loop, I specify that the buttonState variable takes the value of the data read from the button pin. Next, I create an if function that monitors whether the button has been pressed or not(HIGH for pressed, LOW for released). Once the data has been received the pin number loops through the array of the pins recognized as outputs. The function turns on the LED, delays that for delaytime -200, which makes half a second, and then it turns it off for 700miliseconds. Afterwards, I have added a delay of almost a second, after which another for function is executed. It loops through the LED pins in reverse order, turning them on and off after a particular delay.
No comments:
Post a Comment