Darkness & light detector LDR
Scan a QR code with Magicbit app
Introduction
Hello and Welcome, This short tutorial will teach you to use the LDR with Magicbit using Magicblocks.
Magicblocks is easy visual programming software to program your Magicbit. Anyone can program their microcontroller by using magicblocks.io and there is no need for programming knowledge. You can sign up for free.
Start and Open the Playground.
Setting Up the Analog In Block to read LDR.
- Drag & drop the Analog In block from the input nodes section on the left of the screen to the Flow.
- Double-click on the Analog In block.
- Select your unique Device ID from the drop-down menu.
- select pin as LDR(36) from the drop-down menu.
- Select Method as Interrupt from the drop-down menu.
Set up the Range Block
- Drag & drop the range block from the general nodes section on the left of the screen to the Flow.
- Double-click on the Range block and change the input range and output result range.
Make a dashboard
Suppose you don’t know how to create a dashboard. don’t worry! Click here to learn how to make a web Dashboard.
- Drag & drop the Gauge block from the dashboard nodes section on the left of the screen to the Flow.
- Double-click on the Gauge block and change the settings
Deploy Program
• Click on the Deploy button on the top right-hand corner of the screen.
• After deploying, go to the dashboard UI by clicking the dashboard button on the left side .
Now you can see the values change according to the light level hitting the Magbit board (LDR).