Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

.//fdefine LED LED RED nt LED1 LED RED; 3 int x = x+1 4 // define LED LED GREEN

ID: 3882078 • Letter: #

Question

.//fdefine LED LED RED nt LED1 LED RED; 3 int x = x+1 4 // define LED LED GREEN Sint LED2 = LED GREEN; 26 int x=0 27 28 /1 the setup routine runs once when you press reset: 29 void setup) t 30 initialize the digital pin as an output. 31 pinMode (LEDI, OUTPUT): 32 pinMode (LED2, OUTPUT) 33) 34 35 // the loop routine runs over and over again forever: 36 void 1oopO 37 digicalWrice (LEDI, HIGH): / curn the LED on (HIGH is the voltage level) turn the LED orr by making the voltage LOW LED2, LOR): 39 delay (500) // wait for a second igitalwrice (LED2, RTGH): curn the LED on (RIGH is the voltage level) digitalwrite (LEDI. LOW) / turn the LED oft by making the voltage LOW 42 delay (500) wait tor a second

Explanation / Answer

Here in the definition section, you can define leds by either
#define LED1 LED_RED where LED_RED must be the constant int which defines pin number to which red led is connected. You can also directly pass that pin number
or
int LED1=LED_RED; or int LED1=14;//for eg led is connected to pin number 14

there is no need to define variable x because you have never used after.

setup() function will be called once in the beginning.

pinMode function will set both LEDs as an output.