MagicCode Lesson 04: Blinking a LED
MagicCode Lesson 4

Blinking a LED

Learn how to blink a LED

Components Required



In this example you are learning how to turn on and off a LED or any other actuator which can be controlled by a digital output such as relay, bulb, motor.


A digital output allows you to control a voltage with an electronic device. If the device instructs the output to be high, the output will produce a voltage (generally about 5 or 3.3 volts). If the device instructs the output to be low, it is connected to ground and produces no voltage.Here Magicbit is the device and output voltage is either 3.3V for HIGH and 0V for LOW.


Magicbit equipped with four onboard leds in Magicbit development board, Lets select yellow LED (which is wired to D18)




By setting output state to high of LED pin will turn on the led and by setting output state to LOW will turn of LED.


Drag and Drop following blocks from Events, control and MagicBit lists of the block palette and make the script.



This program starts by clicking the Green flag. The forever block continuously runs the code held inside the block. The digital pin has set to pin 18 because Yellow Led has connected to the D18 pin on the board. The waiting time has set to 1 second. According to the Script, the Yellow LED turn on for one second and turn off for one second continuously.

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *