I am working on a PWM project using the LED RGB LightStrips. I have the circuit built according to the link
http://www.ladyada.net/products/rgbledstrip/
Now I am trying to drop the Arduino and apply the Android IOIO board. My arduino code is as follows ...
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
void loop() {
int r, g, b;
// fade from blue to violet
for (r = 0; r < 256; r++) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from violet to red
for (b = 255; b > 0; b--) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from red to yellow
for (g = 0; g < 256; g++) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
// fade from yellow to green
for (r = 255; r > 0; r--) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from green to teal
for (b = 0; b < 256; b++) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from teal to blue
for (g = 255; g > 0; g--) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
}
As I read about analogWrite for Arduino which is a max pwm of 255. Now when I plug in the IOIO board my code is as follows
public void setup() throws ConnectionLostException {
try {
blueOutput_ = ioio_.openPwmOutput(14, 490);
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN, true);
enableUi(true);
} catch (ConnectionLostException e) {
enableUi(false);
throw e;
}
public void loop() throws ConnectionLostException {
try {
blueOutput_.setPulseWidth(seekBlue.getProgress());
led_.write(!toggle.isChecked());
sleep(10);
} catch (InterruptedException e) {
ioio_.disconnect();
} catch (ConnectionLostException e) {
enableUi(false);
throw e;
}
}
}
Notice I have the frequency matched with the Arduino and IOIO at 490 Hz. Now when I output a PWM mod on the pin 14, the LED begins to light up but maxes out way before it is near its max brightness. If I increase the PWM above 255, the intensity of the blue (and red and green) does not increase. I have 12V into the RGB Light strip with is a length of 3 LED Lights (roughly 1.75" for testing purposes)
Is there a reason I cannot get the same response from the IOIO as the Arduino? Thank You.