Readme and properties file added
This commit is contained in:
parent
460a396a21
commit
e46ef04631
|
@ -0,0 +1,40 @@
|
||||||
|
# SimpleLed
|
||||||
|
|
||||||
|
This Arduino IDE library is a simple way to control an RGB LED. It can also be used for other micro controllers that can be programmed via Arduino IDE.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Put this folder into your `~/Arduino/libraries` folder.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Include the header file `SimpleLed.h` and initialize the module with three PWM pins of your micro controller (in the case of the Arduino Uno 3, 5 and 6 for instance). Don't forget to call `begin()` in the setup() method. Now you can use both methods `setColor()` and `translateToColor()` to control your LED.
|
||||||
|
|
||||||
|
The RGB Colors are specified with the `Color` type. Red, green and blue can have values between 0.0 (off) and 1.0 (completely on).
|
||||||
|
|
||||||
|
The following example defines three colors RED, GREEN and VIOLET and uses the two methods to control the led:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include <SimpleLed.h>
|
||||||
|
|
||||||
|
const Color RED = {1.0, 0.0, 0.0};
|
||||||
|
const Color GREEN = {0.0, 1.0, 0.0};
|
||||||
|
const Color VIOLET = {1.0, 0.0, 1.0};
|
||||||
|
|
||||||
|
SimpleLed led(3, 5, 6);
|
||||||
|
|
||||||
|
void setup {
|
||||||
|
led.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop {
|
||||||
|
led.setColor(RED);
|
||||||
|
delay(1000);
|
||||||
|
led.translate(GREEN, 3000);
|
||||||
|
delay(1000);
|
||||||
|
led.setColor(VIOLET);
|
||||||
|
delay(1000);
|
||||||
|
led.translate({1.0, 0.5, 0.0}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
|
@ -0,0 +1,9 @@
|
||||||
|
name=SimpleLed
|
||||||
|
version=1.0.0
|
||||||
|
author=Mal
|
||||||
|
maintainer=Mal
|
||||||
|
sentence=A simple Arduino library for RGB LED control
|
||||||
|
paragraph=A simple Arduino library for RGB LED control. Just specify the three pins for red, green and blue and set colors or fade from one color to another.
|
||||||
|
category=Signal Input/Output
|
||||||
|
url=https://git.leinelab.org/Mal/SimpleLed
|
||||||
|
architectures=*
|
Loading…
Reference in New Issue