Reader small image

You're reading from  Practical Python Programming for IoT

Product typeBook
Published inNov 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838982461
Edition1st Edition
Languages
Right arrow

Implementing a dweeting button

This program in dweet_button.py integrates the GPIOZero push button example with dweet.io. Earlier in this chapter, in the section titled Running and testing the Python server, we copied and pasted URLs into a web browser to control our LED.

When you run dweet_button.pyeach time you press the button, this program cycles through the dweet.io URLs to change the LED's state. To configure this program, find and update the following line with the thing name you are using with dweet_led.py:

thing_name = '**** ADD YOUR THING NAME HERE ****'

Remember, that you'll also need the dweet_led.py program to be running in a Terminal, otherwise, the LED will not respond to your button presses.

Next, we see how to mimic GPIOZero using PiGPIO and a Python class.

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Practical Python Programming for IoT
Published in: Nov 2020Publisher: PacktISBN-13: 9781838982461