Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Finish the Missing Arduino code (//completed by student) and explain the function of the code line by ine LAB2 BY HERNAN LOZANO unsigned long ms
Finish the Missing Arduino code (//completed by student) and explain the function of the code line by ine LAB2 BY HERNAN LOZANO unsigned long ms runtime int one ms_timeri //DEFINE ALL TIMERS AS UNSGNED LONG 7These timers are incremented every 100ms-0.1s unsigned longtimerl; used for blinking LELD unsigned long button dbnc-tmr = 0; // button_dbnctmr for debouncing input const int buttonPin2 const int LED1 13; /GOBAL VARIABLES int state: // possible values 0-1->2 3 -> 0 void setup () /7timerl is read memory ); pnMode (LED1, OUTPUT) ; Serial.begin (9600) //initialize uart void loop () statie bool allow_change static int counter; timers )i if (digitalRead (buttonPin)1) void turnoff( /TURN OFF OUTPUT if (allow_change- 1) /TO BE COMPLETED BY STUDENT counter++ if (button dbnc tmr > 10) void flash 1s) //flash output every one second //TO BE COMPLETED BY STUDENT state++ Serial printin(counter) allow change 0; if (state 3) void flash 2s () [//flash output every to seconds //TO BE COMPLETED BY STUDENT state-0 Serial println(state) update memory ) void flash 3s () //flash output every three seconds //TO BE COMPLETED BY STUDENT Finish the Missing Arduino code (//completed by student) and explain the function of the code line by ine LAB2 BY HERNAN LOZANO unsigned long ms runtime int one ms_timeri //DEFINE ALL TIMERS AS UNSGNED LONG 7These timers are incremented every 100ms-0.1s unsigned longtimerl; used for blinking LELD unsigned long button dbnc-tmr = 0; // button_dbnctmr for debouncing input const int buttonPin2 const int LED1 13; /GOBAL VARIABLES int state: // possible values 0-1->2 3 -> 0 void setup () /7timerl is read memory ); pnMode (LED1, OUTPUT) ; Serial.begin (9600) //initialize uart void loop () statie bool allow_change static int counter; timers )i if (digitalRead (buttonPin)1) void turnoff( /TURN OFF OUTPUT if (allow_change- 1) /TO BE COMPLETED BY STUDENT counter++ if (button dbnc tmr > 10) void flash 1s) //flash output every one second //TO BE COMPLETED BY STUDENT state++ Serial printin(counter) allow change 0; if (state 3) void flash 2s () [//flash output every to seconds //TO BE COMPLETED BY STUDENT state-0 Serial println(state) update memory ) void flash 3s () //flash output every three seconds //TO BE COMPLETED BY STUDENT
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started