Code Monkey home page Code Monkey logo

led-flow's Introduction

Introduction

If you need to control a series of led activities/patterns in a non-blocking fashion then this library is for you.

Features

  • Non-blocking
  • Fluent API Interface
  • Define a chain of led activity configurations that you can assign, reuse and playback for any led instance.
  • More flexibility in controlling the light patterns for complex activities

Installation

Arduino

  1. Browse to the arduino library/sketchbook location

  2. Navigate to the libraries folder

  3. Clone the repository into the libraries folder

    git clone https://github.com/ribasco/Led-Flow.git

  4. Restart the Arduino IDE (If open)

  5. In your sketch, include the library by typing

#include <LedFlow.h>

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

or simply via the Arduino Menu

Sketch -> Include Library -> Led Flow

Usage

Basic Usage

Please note that using the setValue* methods are the same as calling analogWrite(value).

  1. Turning on/off a Standard LED
#include <LedFlow.h>

#define PIN_LED           6

LedSingle ledSingle = LedSingle(PIN_LED); 

void setup() {
        //Turn On: Set to the maximum brightness (255)
	ledSingle.setValue(255);
	
	//Turn off
	//ledSingle.setValue(0);
}

void loop() {
}
  1. Turning on/off an RGB LED
#include <LedFlow.h>

#define PIN_LED_R 	2
#define PIN_LED_G 	3
#define PIN_LED_B 	4

LedRgb ledRgb = LedRgb(PIN_LED_R, PIN_LED_G, PIN_LED_B); 

void setup() {
        //Set the value of all pins
	ledRgb.setValue(RGB(255, 0, 0));
	 
	//The following code below individually sets the color value of each RGB Pin. 
	// Using this method will not override the values of the other pins. 
	//ledRgb.setValueRed(0);
	//ledRgb.setValueGreen(255);
	//ledRgb.setValueBlue(255);
}

void loop() {


}

Advanced Usage

led-flow's People

Stargazers

 avatar  avatar

Watchers

 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.