Controlling LED on Maker pHAT Using Raspberry Pi and Blynk

Always do Blynk with Arduino? How about Raspberry Pi?

INTRODUCTION

Blynk is a popular Internet of Things platform with a drag-n-drop mobile application builder that allows to visualize sensor data and control electronics remotely. This week we will show you how to control LED on Maker pHAT using Raspberry Pi and Blynk.

VIDEO

This video will show you how to control LED on Maker pHAT using Raspberry Pi and Blynk app. We used python library for programming.

HARDWARE PREPARATION

Sample Program

This code will allow you to control LED on Maker pHAT (Raspberry Pi’s GPIO pin) using Blynk app. Please replace YourAuthToken to your Blynk token.

from gpiozero import LED
import BlynkLib
import time
led1 = LED(25)
BLYNK_AUTH = 'YourAuthToken'
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
# Register Virtual Pins
@blynk.VIRTUAL_WRITE(1)
def my_write_handler(value):
print('Current V1 value: {}'.format(value[0]))
if int(format(value[0])) == 1:
led1.on()
else:
led1.off()
try:
while True:
blynk.run()
except KeyboardInterrupt:
sys.exit(0)
view raw BlynkLEDMakerpHAT.py hosted with ❤ by GitHub

Thank You

References

  1. blynk-library-python from vshymanskyy

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

2 thoughts on “Controlling LED on Maker pHAT Using Raspberry Pi and Blynk”

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

DIY Interactive Robot Using REKA:BIT With Micro:bit
BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
DIY Automated Vacuum Cleaner Using REKA:BIT With Micro:bit
Rainbow Spark in Mini House using Maker Uno.
Tutorials of Cytron Technologies Scroll to Top