RGB LED Help

I’ve Got Some Addressable RGB LEDs (Strip) (WS2801)
I Need help hooking them up to my arduino I’ve tried example codes but they seem to have an error or don’t work

What is the error?

CODE:
// walking r-g-b
for (int j = 0; j < 3; j++) {
memset(leds, 0, NUM_LEDS * 3);
for(int i = 0; i < NUM_LEDS; i++ ) {
switch((i+j) % 3) {
case 0: leds*.r = 200; break;
case 1: leds*.g = 200; break;
case 2: leds*.b = 200; break;
}
}
FastSPI_LED.show();
delay(300);

ERROR:
expected unqualified-id before ‘for’

Please excuse me For I am Somewhat New to the coding***

Resource:
http://davidbu.ch/mann/blog/2011-09-29/arduino-and-ws2801-rgb-led-strip.html

Looks like an issue with function structure.

Is your code in main()?

Is your function header correct?

Additionally, it’s often a good idea to google your errors. There’s rarely an error that StackOverflow hasn’t seen.

  • Sunny G.

im honestly confused .
lets just start from the beginning and code this.
Ok What I want to do first is just power the LEDs

I personally do not know how to work with arduinos/LEDs, I suppose someone else could help you out there.

But seriously, Google.

  • Sunny G.

I got a set of this light strip from adafruit. Tutorial was great.

Go to the menu on the left side of the page, read through the code, wiring, troubleshooting, etc. ::rtm::

Took me a bit of homework to get mine working, but it now works like a champ. I simply used their example code from their Arduino library (see the code page), and modified it to get the behavior I wanted.

currently reading this info

Adafruit’s tutorials are the way to go.

If you haven’t used an Arduino before, it’s C, but they hide main(). You use setup() once to set up, then loop() for every loop. Make sure you download the LED libraries (Adafruit will point you the way) and put them in the Arduino \libraries. The LED library has examples of simple code to give you an idea how to light up.

Hardware tip: If you power the LEDs separate from the Arduino, make sure you run a ground wire between the two. Otherwise it’ll be exciting lighting but not remotely what you want. (It won’t ruin them, btw.)

Software tip: I forget the exact command, but if you’re using Adafruit’s library, if you don’t do “.show” before the end of loop() the LEDs won’t update.

Thanks you guys got it working!

ToDo:
Download the Library from here(https://github.com/adafruit/Adafruit-WS2801-Library) to use this script!

Function:
Changes the color between /Black (off)/Red / Green / Blue /White) with a delay of 1 Second.

BTW, I got my ws2801 led pixels from http://www.lightingnext.com/12mm-ws2801-diffused-thin-digital-rgb-led-pixels.html