-
Notifications
You must be signed in to change notification settings - Fork 4
/
LEDEffect.h
41 lines (37 loc) · 838 Bytes
/
LEDEffect.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
LEDEffect.h - Library for LED Effecs.
Created by Harrison H. Jones, October 3, 2014.
*/
#ifndef LEDEffect_h
#define LEDEffect_h
#if defined (SPARK)
#include "application.h"
#else
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#endif
class LEDEffect
{
public:
LEDEffect(int pin);
void update();
void off();
void on();
void breath(int ledDelay);
void fadeDown(int ledDelay);
void fadeUp(int ledDelay);
void blink(int ledDelay);
void dim(unsigned char brightness);
private:
int _pin;
unsigned char _brightness;
unsigned char _fadeAmount; // how many points to fade the LED by
unsigned char _fadeDirection;
unsigned char _ledState; // 0 = off, 1 = on, 2 = breath, 3 = fade down, 4 = fade up, 5 = blink
int _ledDelay; // in ms
unsigned long _time;
};
#endif