Categories: AndroidCodingElectronicsTinkercad

Blinking An LED with Arduino in Tinkercad

Blinking An LED with Arduino in Tinkercad

The Arduino board can be more than a glorified push button for electronic circuits. We can do so much more with Arduino and in this lesson, we will take a closer look at what can be done with code and a basic circuit with a Light Emitting Diode, LED. This lesson builds on a previous lesson where we activated an LED with Arduino and a few lines of code.

Click the code editor button to open the coding panel. Click on the Control code block category and look for the wait code block.


Place the wait code block below the set pin code block. The wait argument is set to one second. Leave the argument at this variable. Go back to the Output code block category and place another set pin code block onto the canvas below the wait code block.


Set the pin argument value to 3 and the state to low. Low will turn off the light by turning off the current that goes to the circuit. Run the simulation. The LED will turn on and off but the off state is too short. Arduino is a very simple computer but it is still very fast and processes our instructions in fractions of a second. We need to instruct the code to slow things down so we have time to see the changes.


Add another wait code block and run the simulation again. This time the LED in the simulation will turn on and off repeatedly.


The code blocks we use are representations of written code. The written code is shown on the right side. The code has two main sections or functions. The void setup function is used to set pin 3 as the output pin for the instructions. The void loop function is where we write the main part of our code. The void loop repeats the code within the function until the simulation stops or until the power is turned off on a physical Arduino board.

The void loop instructs the board to set the power to pin 3 to high or On then wait one second. After one second the power to pin 3 is set to low or turned off and then wait one second. The instructions repeat all over again until we stop it by removing power from the Arduino board.

Alex :