forked from sowbug/G35Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCylon.cpp
More file actions
26 lines (19 loc) · 683 Bytes
/
Cylon.cpp
File metadata and controls
26 lines (19 loc) · 683 Bytes
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
/*
G35: An Arduino library for GE Color Effects G-35 holiday lights.
Copyright © 2011 The G35 Authors. Use, modification, and distribution are
subject to the BSD license as described in the accompanying LICENSE file.
By Mike Tsao <http://github.com/sowbug>.
See README for complete attributions.
*/
#include <Cylon.h>
Cylon::Cylon(G35& g35) : LightProgram(g35), orbiter_(0.5, 0.01), last_x_(0) {}
uint32_t Cylon::Do() {
orbiter_.Do();
uint8_t x = orbiter_.x_local(light_count_, light_count_ >> 1);
if (last_x_ != x) {
g35_.set_color(last_x_, 255, COLOR_BLACK);
last_x_ = x;
}
g35_.set_color(x, 255, orbiter_.color());
return bulb_frame_ >> 1;
}