Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   RGB LED Help (http://www.chiefdelphi.com/forums/showthread.php?t=116011)

DjParaNoize- 13-04-2013 00:51

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

mman1506 13-04-2013 00:52

Re: RGB LED Help
 
What is the error?

DjParaNoize- 13-04-2013 00:58

Re: RGB LED Help
 
Quote:

Originally Posted by mman1506 (Post 1261222)
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[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

DjParaNoize- 13-04-2013 01:02

Re: RGB LED Help
 
Resource:
http://davidbu.ch/mann/blog/2011-09-...led-strip.html

ttldomination 13-04-2013 01:04

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.

DjParaNoize- 13-04-2013 01:13

Re: RGB LED Help
 
Quote:

Originally Posted by ttldomination (Post 1261227)
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

ttldomination 13-04-2013 01:27

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.

Pendulum^-1 13-04-2013 01:30

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. ::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.

DjParaNoize- 13-04-2013 01:40

Re: RGB LED Help
 
Quote:

Originally Posted by Pendulum^-1 (Post 1261234)
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. ::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

Roger 13-04-2013 02:23

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.

DjParaNoize- 13-04-2013 03:02

Re: RGB LED Help
 
Thanks you guys got it working!

kathy82 30-07-2013 02:57

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


All times are GMT -5. The time now is 11:15.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi