Skip to content

Instantly share code, notes, and snippets.

@FredrikL
Created April 8, 2012 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FredrikL/2336647 to your computer and use it in GitHub Desktop.
Save FredrikL/2336647 to your computer and use it in GitHub Desktop.
ball
#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