Ive just bought a Rainbowduino to control a load of individual LEDs (NOT an RGB matrix). All the documentation so far is aimed towards controlling RGB arrays which is not what I'm after.
Ive connected up 16 LEDs and want to be able to turn each one on and off individually with digitalWrite(). Ive uploaded some demo code to the board which is kind of working. I dont know the numbers of the pins of the board so Im not sure if Im even controlling the correct ones.
void setup() // run once, when the sketch starts
{
int i;
for(i = 0; i <=32; i ++)
{
pinMode(i, OUTPUT);
}
}
void loop() // run over and over again
{
int i;
for(i = 0; i <=32; i ++)
{
digitalWrite(i, HIGH);
delay(250);
digitalWrite(i, LOW);
}
}
I kind of hoped this would make a basic LED chaser, but of course it doesnt. Half the lights just flash on and off randomly.
If it is 12V across an LED it is entirely likely that there is an internal resistor built in. If not they blow quicker than ..... insert something that blows quickly and won't get censored ....
INTENSITY 10000—12000mcd
FORWARD VOLTAGE 12volts
FORWARD CURRENT 20m/a
DOMI WAVELENGTH nm
HOUSING WATER CLEAR
VIEWING ANGLE 15 degrees
THESE LEDS WORK FROM 12 VOLTS NO RESISTOR REQUIRED
So I presume they've got a resistor built in. Anyway, can anybody help me with my pin problem?
Using just digitalWrite() with the rainbowduino is a bit tricky. 8 of the pins on it are connected to a source driver that can be accessed by digitalWrite(), but I don't know which PORT on the chip is used for that. These usually drive the ROWs of the RGB matrix. The other 24 pins are connected to 3 shift register constant current sink drivers and they can only be accessed using hardware SPI or the shiftout() function.
The best source would be a manual or have a look at the example code. Especially the include file should reveal what you need.
Well first you have to solve the voltage problem. How and what are you using to power the 12vdc LEDs? (it's hard to see from your picture)
The Arduino digital pins cannot switch 12vdc devices directly, you will need switching transistors between the Arduino's I/O pins and the LEDs to safely switch them on and off. After you have the electrical part correct you/we can deal with the software side. If you had bought just normal LEDs then all you would require is simple current limiting resistor between each Arduino's output pins and it's associated LED, just like the pin 13 built in LED that the blink sketch uses.
Thanks for your reply, ive looked over the sample sketch which came with the the board but im a bit lost. Will take another look though incase something pops out which I missed.
Lefty,
The Rainbowduino is slightly different to a standard Arduino as it has 24 constant current channels of 120mA, 8 super source driver channel of 500mA each and a wide output voltage adaption from 5V-12VDC. So I shouldn't need the transistors ( I think :-? )
Im still stuck on this. I just cant work out how the shift register works. Ive looked over the arduino docs, the rainbowduino sample sketch and played around with shiftOut but I just cant get anything to work.
Maybe this was a bit too big to be taking on as my first Arduino project
I dont know the numbers of the pins of the board so Im not sure if Im even controlling the correct ones.
and
I kind of hoped this would make a basic LED chaser, but of course it doesnt. Half the lights just flash on and off randomly.
So you need to make sure you are driving the right pins in the order you intend, or how else can you expect all the LEDs to come on in the right sequence?