Turn on LED Through Internet [MagicBlocks]

by magicbit in Circuits > Electronics

151 Views, 0 Favorites, 0 Comments

Turn on LED Through Internet [MagicBlocks]

Turn On LED through Internet [MagicBlocks]

This tutorial will teach you to Control LED on your Magicbit using Magicblocks.

Supplies

  • Magicbit - Pro

Story

Hello and Welcome, This short tutorial will teach you to contol LED on your Magicbit using Magicblocks.

There are 2 main methods of achieving this goal;

  • By using Inject Block.
  • By using Dashboard Switch.

First of all log into to your Magicblocks account,

Magicblocks is an easy visual programming software for program your magicbit. Anyone can program their micro controller by using magicblocks.io and there is no need of programming knowledge. You can sign upfor free.

Start and Open the Playground.

Next make sure your Magicbit is connected to the internet and plugged-in and also linked to your account through Device Manager.

All Done? then scroll down to Method 1

List of Items Required

List of Items Required

Magicbit: Magicbitis an integrated development platform based on ESP32 for learning, prototyping, coding, electronics, robotics, IoT and solution designing.

Setting Up the Inject Block [Method 1]

screenshot_(56)_YqoU6ROUFD.jpg
screenshot_(58)_QjGxkrDK6P.jpg
screenshot_(59)_USHtAx53e5.jpg
screenshot_(60)_88AwVLnonv.jpg

1. Drag & drop the Inject block from the input nodes section on the left of the screen to the Flow.

2. Double-click on the block and select the type of payload from the drop-down menu to a numerical input (number).

3. Setup the node name[optional] and number to inject (0 or 1).

Setting Up the Digital Out Block [Method 1]

screenshot_(69)_GAnsxT4hFf.jpg
screenshot_(67)_SSXOYyNFB4.jpg
screenshot__32__HlJduVxqz0.jpg
screenshot_(61)_luvspynsD2.jpg

1. Drag & drop the Digital out block from the Magicbit nodes section on the left of the screen to the flow.

2. Double-click on the digital out block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the digital out block with your Magicbit ]

3. Set the PIN to one of the LED Pins.

[Optional] Import Already Setup Nodes

Capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

If you had trouble setting up nodes, you can use the import feature in Magicblocks to get the nodes which has been already setup.

  • First copy this code to your clipboard.
  • Click on the options menu on the top right-hand corner of the screen.
  • Next hover your cursor over the Import sub-menu.
  • Then click on Clipboard and paste the code on your clipboard to the text field.
  • Select current flow or new flow and click on Import.

IMPORTANT

Make sure you type your device id on the display node properties and type the text you need inside the inject node.

Finally Deploying the Blocks [Method 1]

screenshot_(62)_CsFynspgsB.jpg

1. Connect the inject block with the Digital Out node.

2. Click on deploy button on the top right-hand corner of the screen.

3. After deploying click on the box left-side of the inject block to activate it and if you click the 'On' inject block the LED you chose will turn on, next click on the 'Off' inject block to turn it off.

To Control All Four LEDs at Once

screenshot_(62)_DXyTfwTl5j.jpg
screenshot_(63)_jH5Iw0wn3u.jpg
screenshot_(64)_J6OuLujJ1D.jpg

1. Duplicate the Digital Out block 3 times and assign each block to four LED Pins.

2. Next connected 'On' and 'Off' inject blocks with the new Digital Out block.

3. Click on Deploy button on the top right-hand corner of the screen.

4. After deploying click on the box left-side of the inject block to activate it and if you click the 'On' inject block the LEDs you chose will turn on, next click on the 'Off' inject block to turn it off.

Troubleshooting [Method 1]

  • Check whether it shows connected(or 1/0) below the display block if not recheck the device id which you typed into the display block.
  • Check whether your Magicbit is connected to the internet.

Setting Up the Switch Block [Method 2]

screenshot_(65)_agR2N5xHmh.jpg
screenshot_(66)_pC5mHGJOdF.jpg

1. Drag & drop the Switch block from the dashboard nodes section to the Flow.

2. Double-click on the Switch node and set up a basic dashboard ui [user- interface] from the drop-down menu and a name for your field.

3. Select the Mode as number input from the drop-down menu for both On and Off. And set on payload as 1 and off payload as 0.

Setting Up the Digital Out Block [Method 2]

screenshot_(67)_zMgUMg4CA9.jpg
capture.JPG
screenshot__34__LgAo8klYI3.jpg
screenshot__35__x1BhIXZnSM.jpg
screenshot__37__sCxZ7X5jV4.jpg

1. Drag & drop the Digital out block from the Magicbit nodes section on the left of the screen to the flow.

2. Double-click on the digital out block and type or paste your unique Device id from the Device Manager Tab on your Magicblocks account. [ This will link the digital out block with your Magicbit ]

[Optional] Import Already Setup Nodes

  • First copy this code to your clipboard.
  • Click on the options menu on the top right-hand corner of the screen.
  • Next hover your cursor over the Import sub-menu.
  • Then click on Clipboard and paste the code on your clipboard to the text field.
  • Select current flow or new flow and click on Import.

IMPORTANT

Make sure you type your device id on the display node properties and type the text you need inside the inject node.

Finally Deploying the Blocks & Using the Dashboard UI to Access It [Method 2]

screenshot_(70)_6UfxCC6pwj.jpg
screenshot_(71)_4nQryObhwR.jpg
screenshot_(73)_hD62lHh6uu.jpg

  • Connect the Switch block with the Digital Out node.
  • Click on Deploy button on the top right-hand corner of the screen.
  • After deploying go to the dashboard ui by clicking the link to dashboard URL on the top right-hand corner of the screen.
  • Once in the dashboard you can toggle the switch you just setup on and off to control the LED you assigned to the digital out block.
  • Copy the your Dashboard URL and this can be accessed via the internet to display text onto your Magicbit Display from anywhere in the World.

To Control All Four LEDs at Once

screenshot_(72)_Vm7avfhAaz.jpg

1. Duplicate the Digital Out block 3 times and assign each block to four LED Pins.

2. And connect them with the switch block.

3. Click on Deploy button on the top right-hand corner of the screen.

4. After deploying go to the dashboard ui by clicking the link to dashboard URL on the top right-hand corner of the screen.

5. Now the toggling the switch on and off will control all four LEDs.

  • Copy the your Dashboard URL and this can be accessed via the internet to display text onto your Magicbit Display from anywhere in the World.

Troubleshooting [Method 1]

  • Check whether it shows connected(or 1/0) below the digital out block if not recheck the device id which you typed into the digital out block.
  • Check whether your Magicbit is connected to the internet.