Created
April 8, 2012 11:06
-
-
Save FredrikL/2336647 to your computer and use it in GitHub Desktop.
ball
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LPD8806.h" | |
#include "SPI.h" | |
// code revision for my version of http://www.youtube.com/watch?v=IUhEINPraN8&feature=youtu.be | |
int aX = 0; | |
int aY = 1; | |
int aZ = 3; | |
int stripDataPin = 2; | |
int stripClockPin = 3; | |
LPD8806 strip = LPD8806(16, stripDataPin, stripClockPin); | |
void setup() { | |
strip.begin(); | |
strip.show(); | |
} | |
int r, g, b; | |
void loop() { | |
r = analogRead(aX) / 4; | |
g = analogRead(aY) / 4; | |
b = analogRead(aZ) / 4; | |
colorWipe(strip.Color(r, g, b), 0); | |
delay(100); | |
} | |
void colorWipe(uint32_t c, uint8_t wait) { | |
int i; | |
for (i=0; i < strip.numPixels(); i++) { | |
strip.setPixelColor(i, c); | |
strip.show(); | |
delay(wait); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment