Skip to content

Instantly share code, notes, and snippets.

@FredrikL FredrikL/ball.ino
Created Apr 8, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.