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

Please use the Arduino MC in TinkerCad with a single LED as shown below and run

ID: 2267520 • Letter: P

Question

Please use the Arduino MC in TinkerCad with a single LED as shown below and run the simulation. When you choose the Arduino MC, TinkerCad adds the default code for the Blink program that turns the LED on and off in a loop. If you look at the code in Code Editor, you will see that the LED is connected to Digital Pin 13. As I have mentioned before the same code will also run on the real Arduino MC. Also note that all Arduino code - regardless of how complex they are contain just two functions: setup and loop. Setup is used to set the initial one-time configuration and the loop is the active body of the function that will run as long as there is power.

Explanation / Answer

FOR BLINKING ON LED :

YOUR FIRST LAB ASSIGNMENT CODE IS HERE

void setup()
{
// put your setup code here, to run once:
pinMode(13,OUTPUT);
}

void loop()
{
// put your main code here, to run repeatedly:
while(1)
{
     digitalWrite(13,1);
     delay(100);
     digitalWrite(13,0);
     delay(100);
}

}

YOU SECOND LAB ASSIGNMENT:

FOR BLINKING 3 LEDS LIKE TRAFIC LIGHTS :

ONE LIGHT WILL BLINK ONCE IN A TIME:

void setup()
{
// put your setup code here, to run once:
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
}

void loop()
{
// put your main code here, to run repeatedly:
while(1)
{
     digitalWrite(13,1);
     digitalWrite(12,0);
     digitalWrite(11,0);
     delay(100);
     digitalWrite(13,0);
     digitalWrite(12,1);
     digitalWrite(11,0);
     delay(100);
     digitalWrite(13,0);
     digitalWrite(12,0);
     digitalWrite(11,1);
     delay(100);
}

}