Page 99 - KEC Khaitan C8.2 Flipbook
P. 99

Timing  is crucial: it  decides  how  long each state  (e.g.,  an LED  turned on) should last before
                 switching to another. This lesson will show you how to use visual blocks to control Arduino pins
                 and create delays between different actions.


                 SETTING UP DIGITAL OUTPUTS IN BLOCK CODING

                 Defining a Pin as an Output
                 In many block-based programming tools, you’ll see a block that looks like:







                   HIGH often means “on” (5V for many microcontrollers).

                   LOW means “off” (0V).



                           BLINK AN LED: THE SIMPLEST DIGITAL OUTPUT TEST


                 A basic yet powerful exercise in controlling outputs is to make a single LED turn on and off in a
                 repeated rhythm, allowing you to confirm that the board, wiring, and timing commands are all
                 functioning correctly.


                 DESIGNING A TINKERCAD CIRCUIT
                 Steps to blink an LED in Tinkercad:

                 Step  1    Open Tinkercad and create a new circuit.

                 Step  2    Add an Arduino Uno board.
                 Step  3    Place the LED on the breadboard.

                 Step  4    Attach 330Ω resistor to LED’s anode(+).

                 Step  5    Wire the LEDs to Arduino digital pin 13:
                 Step  6    Connect the breadboard GND rail to the Arduino GND.


























                                                                               Controlling Outputs & Managing Timing  97
   94   95   96   97   98   99   100   101   102   103   104