LED brightness control using a potentiometer
Hello and Welcome, This short tutorial will teach you to use the POTENTIOMETER 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 Potentiometer.
- 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 POT(39) 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. potentiometer gives an analog voltage from 0 to 3.3V and it converts to a digital value of 0 to 4095. but for the analog out we use 0 to 255 values.
Add Analog out
- Drag & drop the Analog out block from the magicbit nodes section on the left of the screen to the Flow.
- Double-click on the Analog out block and change the device id and pin.
• Click on the Deploy button on the top right-hand corner of the screen.
Now you can see the LED brightness change according to the potentiometer angle on the Magicbit board.