|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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 |
|
#2
|
||||
|
||||
|
Re: RGB LED Help
What is the error?
|
|
#3
|
||||
|
||||
|
Re: RGB LED Help
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[i].r = 200; break; case 1: leds[i].g = 200; break; case 2: leds[i].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 |
|
#4
|
||||
|
||||
|
Re: RGB LED Help
|
|
#5
|
||||
|
||||
|
Re: RGB LED Help
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. |
|
#6
|
||||
|
||||
|
Re: RGB LED Help
Quote:
lets just start from the beginning and code this. Ok What I want to do first is just power the LEDs |
|
#7
|
||||
|
||||
|
Re: RGB LED Help
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. |
|
#8
|
||||
|
||||
|
Re: RGB LED Help
I got a set of this light strip from adafruit. Tutorial was great.
http://learn.adafruit.com/digital-led-strip Go to the menu on the left side of the page, read through the code, wiring, troubleshooting, etc. 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. |
|
#9
|
||||
|
||||
|
Re: RGB LED Help
Quote:
|
|
#10
|
|||
|
|||
|
Re: RGB LED Help
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. |
|
#11
|
||||
|
||||
|
Re: RGB LED Help
Thanks you guys got it working!
|
|
#12
|
||||
|
||||
|
Re: RGB LED Help
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-ws2...ed-pixels.html |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|