In this project, we use Blynk’s Silder to control the brightness of the LED, turning it on and off with Switch.
Before starting this project, we recommend that you complete Get Start with Blynk. The following will give you a clear understanding of Blynk.
2. Create Widget and Datastream
Click on the menu icon in the upper right corner and select edit dashboard.
Add a Switch widget and a Slider widget to the Dashboard.
Create a Datastream for the Switch widget (I used V3). It will be used to control the turning on and off of the LED.
Create a Datastream for the Slider widget (I used V2), its value range is 0 to 100, it will be used to control the brightness of the LED.
When finished, click Save And Apply at the top right.
3. Run the Code
Edit the code
cd /home/pi/blynk-raspberrypi-python sudo nano blynk_light.py
Find the line below and past your
BLYNK_AUTH = 'YourAuthToken'
Run the code.
sudo python3 blynk_light.py
Go to Blynk, operate widget on Dashboard. now you click switch widget will turn on/off LED. slide Slider widget will change LED brightness.