For Loop Syntax

int buttonPin = 2; void setup() { pinMode(buttonPin, INPUT_PULLUP); } void loop() { int buttonValue = digitalRead(buttonPin); if(buttonValue == 0){ for (int counter; counter<5; counter++){ //action to be taken 5 times } } else{ //insert action to be taken //example could be to turn LED or buzzer off } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.