Giter Site home page Giter Site logo

karatektus / rgbleddaemon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ericoporto/rgbleddaemon

0.0 1.0 0.0 594 KB

A tiny simple daemon for controlling a single RGB Led for Raspberry Pi written in Python.

License: MIT License

Python 100.00%

rgbleddaemon's Introduction

RGBLedDaemon

A tiny daemon for controlling a single RGB Led for Raspberry Pi written in Python.

While this daemon requires being sudo to start it, it doesn't require being sudo to change color and blink state of the LED in the GPIO.

Usage

For starting the daemon, type:

sudo python rgbled.py start

You can change color by typing the color:

python rgbled.py color blue

You can turn blinking on by typing:

python rgbled.py blink on

For stopping the daemon, type:

sudo python rgbled.py stop

Schematic

This code uses GPIOs 5, 6 and 13, which are the pins 29, 31 and 33 in the Raspberry Pi 2 Board. Pin 6 is the GND on the same board, and I'm using it.

RGB Led pinout

Real Board

My pin selection comes from the example right here: https://www.hackster.io/windowsiot/rgb-led-sample . Your RGB Led may be different.

Warnings

Right now every time you call the script is called using color or blink, it uses writing on /tmp/ to communicate with the daemon. So I recommend mounting /tmp/ on RAM. To do this, is simple, first, edit the raspberry pi fstab. If you are away, just connect in it using ssh.

To edit the fstab use sudo nano fstab . Once you are connected, add the following line:

tmpfs    /tmp    tmpfs    defaults,noatime,nosuid,size=100m    0 0

Than, just reboot with sudo reboot.

If you want to check if you have already done it before, just use mount or df -h.

I would like to point the following article as source: http://www.zdnet.com/article/raspberry-pi-extending-the-life-of-the-sd-card/ and also thank to dAnjou.

To avoid this, I'm planning to change this communication, but don't know how to right now.

Dependencies

This code uses Sander's Python Daemon from here: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ .

rgbleddaemon's People

Contributors

ericoporto avatar karatektus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.