If you ever have watched knight rider you will remember K.I.T.T and his Scanner, we will replicate this using 6 Neopixels and and Arduino Uno!
Step 1: Connect NeoPixelsAfter all power is removed from the Arduino Board Connect 5v to 5v gnd to gnd and Din to pin 3 and plug it in to your computer!
Step 2: Program the ArduinoDownload the Code Here
I used this code to run the LED's:
#include
#define PIN 3 // the pin your strip is connected to
#define COUNT 6 // how many led's are on that strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(COUNT, PIN, NEO_GRB + NEO_KHZ800); //defines the strips properties
void setColor(int Pixel, int R2, int G2, int B2){
uint32_t color = strip.Color(R2, G2, B2); // make a color
strip.setPixelColor(Pixel, color); //set a single pixel color
strip.show(); //update the colors
}
void setup() {
strip.begin(); // start the strip
strip.show(); // set the strip to black (because we havent told it to do anything yet) }
void loop() {
for(int i = 0; i<4 i++){
setColor(i, 255, 0, 0);
setColor(i - 1, 200, 0, 0);
setColor(i - 2, 150, 0, 0);
setColor(i - 3, 50, 0, 0);
setColor(i - 4, 0, 0, 0);
delay(150);
}
for(int i = 0; i>-4; i--){
setColor(i, 255, 0, 0);
setColor(i + 1, 200, 0, 0);
setColor(i + 2, 150, 0, 0);
setColor(i + 3, 50, 0, 0);
setColor(i + 4, 0, 0, 0);
delay(150); }
}
Step 3: Your Done (IT'S AWESOME WATCHING)
Comments