Skip to content

Library to control Raspberry Pi LEDs from poll based input.

Notifications You must be signed in to change notification settings

Zylvian/RPi-Poll-LEDs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi Poll API LED Controller

A library to control LEDs from poll based input.


Description

A poll in this instance is an object with boolean votes.

e.g "Do you like tacos? (50 for, 3 against")

The current application fetches poll data from a Spring Rest API and converts the sum of the votes into respective ratios for each answer. --> 50 for, 3 against = 94% for, 5% against. The application uses these values to control two parallel strips of red and green LEDs (with PWM), where the amount of LEDs lighting up equals the ratio of votes.

Pin layout

pins : used to control green LEDs.

pins : used to control red LEDs.

pins : used for indicator light when transitioning between polls.

pins : used to ground circuit.

Circuit diagram

- Example circuit diagram for this project


How to use

t = VotesToLeds()
first_votes = Votes(50, 50)
t.fade_to_poll(votes)
sleep(4)
sec_votes = Votes(1,1000)
t.fade_to_poll(sec_votes)
sleep(5)

keywords: Spring, RPi, IoT

About

Library to control Raspberry Pi LEDs from poll based input.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages