Giter Site home page Giter Site logo

notgnoshi / rainbowpy Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 29 KB

Controls an RGB LED strip via serial.

License: MIT License

Arduino 4.11% Python 82.74% C 13.15%
rgb-ledstrip dominant-colors serial-communication rgb-leds addressable-leds fastled

rainbowpy's Introduction

rainbowpy

Controls an RGB LED strip via serial.

So far, with an Arduino (with 5V logic) and the RGB LED strip (USC1903 chipset) found here. Note that most any addressable RGB LED strip will work -- provided it is supported by the FastLED library. Also depends on pyserial.

Current usage (requires the controller sketch to be running on an Arduino):

~ $ ./rainbowpy.py --help
usage: rainbowpy.py [-h] [--version] device

An RGB LED strip interpreter.

positional arguments:
  device         Serial Device. Defaults to /dev/ttyUSB0

optional arguments:
  -h, --help     show this help message and exit
  --version, -v  show program's version number and exit

Note the user that runs the script as should be added to the dialout and tty groups in order to access the serial port. I've also had problems with Arduino sketches restarting whenever a new serial connection is made. There are ways to prevent this functionality, but they require physical modification to your Arduino. To bypass without modifying your Arduino, you can run the sketch sketch with the Serial Monitor open. Or, you could continually have the rainbowpy.py script always running. This makes automation via cron jobs difficult :(

REPL Syntax:

  • color <color> Sets the color of the LED strip. To set the strip to red, use one of the following: color red, color 255 0 0, or color #ff0000. Note that Rainbowpy understands HTML5 named colors, except for RebeccaPurple.
  • dominant Sets the primary color of the LED strip to the dominant screen color. Not yet implemented.
  • brightness <brightness> Sets the LED strip brightness. 0..255.
  • correction [TypicalSMD5050 | TypicalLEDStrip | Typical8mmPixel | TypicalPixelString | UncorrectedColor] Sets the color correction of the LED strip.
  • temperature [Candle | Tungsten40W | Tungsten100W | Halogen | CarbonArc | HighNoonSun | DirectSunlight | OvercastSky | ClearBlueSky | WarmFluorescent | StandardFluorescent | CoolWhiteFluorescent | FullSpectrumFluorescent | GrowLightFluorescent | BlackLightFluorescent | MercuryVapor | SodiumVapor | MetalHalide | HighPressureSodium | UncorrectedTemperature] Sets the LED color temperature.

Note the REPL supports basic tab completion of commands, but will attempt to do so unintelligently.

TODO:

  • Add alarm
    • alarm add 8:00 am and alarm remove 8:00 am? The syntax will be difficult to get right.
    • Flash the light for several minutes.
    • Enable canceling the flashing?
    • Might require threads or other async methods. How to do this without blocking execution of new commands?
  • Clean up and modularize the parser. I'm ashamed of this current garbage.
  • Improve the Arduino controller...
    • Perhaps the packets could be text that the parser verifies and then passes on? This would simplify the parser, but I'm not sure I want to work with text on the Arduino.
    • Fully decide where the main set of functionality will be implemented.
      • Should this go as far as indexing individual LEDs from the Python script?
  • Add better commandline options?
  • Separate arduino control and commandline parsing to enable things like nonblocking flashing.

rainbowpy's People

Contributors

notgnoshi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.