I just bought strip ws2801 160 led + arduino R3. I don't know how to make it work. On the strip LED have 4 wire 5V, CI, DI, GND. Thanks you.
Start here
find theWS2801 library that is discussed.
160 LEDs need quite a bit of current, what do you have for a source?
I don’t know about anybody else, but I can’t read that.
Post your code, use code tags (the # button).
Or, click Addtional Options, Browse to your locally stored file, and Attach it.
Which Arduino are you using?
This is the code. I use Arduino UNO R3.
#include “SPI.h”
#include “Adafruit_WS2801.h”/*****************************************************************************
Example sketch for driving Adafruit WS2801 pixels!Designed specifically to work with the Adafruit RGB Pixels!
12mm Bullet shape ----> https://www.adafruit.com/products/322
12mm Flat shape ----> https://www.adafruit.com/products/738
36mm Square shape ----> https://www.adafruit.com/products/683These pixels use SPI to transmit the color data, and have built in
high speed PWM drivers for 24 bit color per pixel
2 pins are required to interfaceAdafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!Written by David Kavanagh (dkavanagh@gmail.com).
BSD license, all text above must be included in any redistribution*****************************************************************************/
// Choose which 2 pins you will use for output.
// Can be any valid output pins.
// The colors of the wires may be totally different so
// BE SURE TO CHECK YOUR PIXELS TO SEE WHICH WIRES TO USE!
uint8_t dataPin = 2; // Yellow wire on Adafruit Pixels
uint8_t clockPin = 3; // Green wire on Adafruit Pixels// Don’t forget to connect the ground wire to Arduino ground,
// and the +5V wire to a +5V supply// Set the first variable to the NUMBER of pixels in a row and
// the second value to number of pixels in a column.
Adafruit_WS2801 strip = Adafruit_WS2801((uint16_t)7, (uint16_t)7, dataPin, clockPin);void setup() {
strip.begin();
// Update LED contents, to start they are all ‘off’
strip.show();
}void loop() {
// Some example procedures showing how to display to the pixels
drawX(7, 7, 100);
bounce(7, 6, 50);
}void drawX(uint8_t w, uint8_t h, uint8_t wait) {
uint16_t x, y;
for (x=0; x<w; x++) {
strip.setPixelColor(x, x, 255, 0, 0);
strip.show();
delay(wait);
}
for (y=0; y<h; y++) {
strip.setPixelColor(w-1-y, y, 0, 0, 255);
strip.show();
delay(wait);
}}
void bounce(uint8_t w, uint8_t h, uint8_t wait) {
int16_t x = 1;
int16_t y = 2;
int8_t xdir = +1;
int8_t ydir = -1;
int j;
for (j=0; j < 256; j++) {
x = x + xdir;
y = y + ydir;
if (x < 0) {
x = -x;
xdir = - xdir;
}
if (y < 0) {
y = -y;
ydir = - ydir;
}
if (x == w) {
x = w-2;
xdir = - xdir;
}
if (y == h) {
y = h-2;
ydir = - ydir;
}
strip.setPixelColor(x, y, Wheel(j));
strip.show();
delay(wait);
strip.setPixelColor(x, y, 0, 0, 0);
}
}/* Helper functions */
// Create a 24 bit color value from R,G,B
uint32_t Color(byte r, byte g, byte b)
{
uint32_t c;
c = r;
c <<= 8;
c |= g;
c <<= 8;
c |= b;
return c;
}//Input a value 0 to 255 to get a color value.
//The colours are a transition r - g -b - back to r
uint32_t Wheel(byte WheelPos)
{
if (WheelPos < 85) {
return Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if (WheelPos < 170) {
WheelPos -= 85;
return Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}
No no, please Modify your post, use code tags (the # button) and copy & paste your code in. Using quote tags, you get all italics tags & color tags.
Also Copy & paste the error message(s) you are getting.
You have this library in a library older under your IDE's File:Preferences path?
#include "Adafruit_WS2801.h"