All Projects → davesteele → pihut-xmas-asyncio

davesteele / pihut-xmas-asyncio

Licence: GPL-2.0 license
Demonstration driving The Pi Hut Raspberry Pi 3D Xmas tree using Python Asyncio

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to pihut-xmas-asyncio

Cattlepi
effortlessly boot, configure, update and monitor your raspberry pi ☁️
Stars: ✭ 250 (+1566.67%)
Mutual labels:  raspberrypi, raspbian
pirrot
A radio repeater controller (supporting both simplex and duplex operation modes) for the RaspberryPi.
Stars: ✭ 25 (+66.67%)
Mutual labels:  gpio, raspberrypi
52-Weeks-of-Pi
Inspired by Shekhar Gulati's "52 technologies in 2016", I've decided to set a goal of 52 Pi ideas over the next year.
Stars: ✭ 54 (+260%)
Mutual labels:  gpio, raspberrypi
Raspberrypi Ua Netinst
RaspberryPi (minimal) unattended netinstaller
Stars: ✭ 179 (+1093.33%)
Mutual labels:  raspberrypi, raspbian
Rppal
A Rust library that provides access to the Raspberry Pi's GPIO, I2C, PWM, SPI and UART peripherals.
Stars: ✭ 463 (+2986.67%)
Mutual labels:  gpio, raspberrypi
Briarids
An All-In-One home intrusion detection system (IDS) solution for the Raspberry PI.
Stars: ✭ 187 (+1146.67%)
Mutual labels:  raspberrypi, raspbian
rpi2mqtt
Connect RaspberryPi GPIOs and 1-Wire temperature sensors to MQTT 🍰🔘📡
Stars: ✭ 20 (+33.33%)
Mutual labels:  gpio, raspberrypi
Crankshaft
Crankshaft: A turnkey GNU/Linux solution that transforms a Raspberry Pi to an Android Auto head unit.
Stars: ✭ 1,703 (+11253.33%)
Mutual labels:  raspberrypi, raspbian
W1thermsensor
A Python package and CLI tool to work with w1 temperature sensors like DS1822, DS18S20 & DS18B20 on the Raspberry Pi, Beagle Bone and other devices.
Stars: ✭ 446 (+2873.33%)
Mutual labels:  gpio, raspberrypi
Homegenie
HomeGenie, the open source, programmable, home automation server for smart connected devices and applications
Stars: ✭ 313 (+1986.67%)
Mutual labels:  gpio, raspberrypi
Piwheels
Python package repository providing wheels (pre-built binaries) for Raspberry Pi
Stars: ✭ 180 (+1100%)
Mutual labels:  raspberrypi, raspbian
Rpi gpio
Ruby conversion of RPi.GPIO Python module
Stars: ✭ 185 (+1133.33%)
Mutual labels:  gpio, raspberrypi
Pimusicbox
An image (SD-card) to turn the Raspberry Pi into an easy to use MusicBox with Spotify playback and AirTunes streaming
Stars: ✭ 1,967 (+13013.33%)
Mutual labels:  raspberrypi, raspbian
Pivccu
piVCCU is a project to install the original Homematic CCU2 firmware inside a virtualized container (lxc) on ARM based single board computers.
Stars: ✭ 230 (+1433.33%)
Mutual labels:  raspberrypi, raspbian
Gumcp
Web Control Panel for Raspberry Pi
Stars: ✭ 124 (+726.67%)
Mutual labels:  raspberrypi, raspbian
gpio
A RaspberryPi GPIO library written in PHP.
Stars: ✭ 16 (+6.67%)
Mutual labels:  gpio, raspberrypi
Nwjs rpi
[NW.js port for Raspberry Pi] binary compiled for the ARMv6 used in Raspberry Pi (compatible with RPi 2 and RPi 3)
Stars: ✭ 91 (+506.67%)
Mutual labels:  raspberrypi, raspbian
Yahm
Yet Another Homematic Management - Skripte zur Einrichtung der Homematic CCU Oberfläche in einem LXC Container unter Debian Jessie auf ARM CPU (z.B.: Raspberry Pi & Co)
Stars: ✭ 113 (+653.33%)
Mutual labels:  raspberrypi, raspbian
pigpio-client
A nodejs client for pigpio socket interface.
Stars: ✭ 24 (+60%)
Mutual labels:  gpio, raspberrypi
Raspberrysharp
A .NET/Mono IO Library for Raspberry Pi This library is a complete refactoring of Raspberry-Sharp libraries, merged into one library and updated to RB3, CM3 and RB3+
Stars: ✭ 41 (+173.33%)
Mutual labels:  gpio, raspberrypi

pihut-xmas-asyncio

Now with Twinkle!

Demonstration driving the Raspberry Pi PiHut 3D Xmas tree using Python Asyncio

The tree in blinky action

The Pi Hut is selling a 3D Xmas Tree that plugs into the Raspberry Pi GPIO header.

Raspbian includes a Python GPIO Module that facilitates working with PI I/O.

Recent versions of Python include Asyncio, which provides tools to allow multiple I/O-bound functions to work cooperatively in a single-threaded event loop.

This demo blinks each of the 25 lights on the tree at a constant, unique rate.

Note that this is not for the PiHut 3D RGB Tree. I like the smaller (red) LEDs on this tree.

How to Use It

The script requires the rpi.gpio package, which may not be installed by default

sudo apt-get update
sudo apt-get install rpi.gpio

Run './xmas.py' to see the lights blink.

Change the constants in the script to change the blink parameters.

run 'sudo ./install.sh' to have the blink program come up automatically on boot.

The asyncio syntax used here requires Python 3.5 or newer. It will not run on stock Raspbian Jessie.

How it Works, in Brief

In xmas.py, the async keyword turns a function into a coroutine, which is a cousin to a generator function.

Instead of yield-ing, the coroutine returns control to the calling function when it passes control to another coroutine, flagged with the await keyword.

The ensure_future() function submits coroutines to the main event loop, which is then called to kick things off.

The twinkling works by using Pulse Width Modulation (PWM) to randomly vary the brightness of the 'on' LEDs.

This version of xmas.py requires more CPU power than the original (~40% of one core on a Pi 3B, for the single-threaded code). The non-twinkling version, xmas-orig.py, uses less than 1% (Better for the Zero).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].