Strange behavior with setRGBled

This problem might be related to this and therefore this.
I am not using sound and I am using Arduboy 1.1 with an Arduboy. I get the following behavior:

  • setRGBled(255, 0, 0) -> blue light
  • setRGBled(0, 0, 255) -> red light
  • setRGBled(255, 255, 255) -> no light
  • setRGBled(0, 255, 0) -> no light
  • setRGBled(255, 0, 255) -> blue and red light

So either my green led is broken and causes that or there is a bug.

What color do you get when you hold the UP button while powering up (flashlight mode)? It should turn all three of the RGB LEDs on.

You could try controlling the LED in digital output mode instead of PWM. Audio shouldn’t affect it then.

// Blink the RGB LED between red and green

#include <Arduboy.h>

void setup() {
  pinMode(GREEN_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);
}

void loop() {
  digitalWrite(GREEN_LED, LOW); // turn on green LED
  digitalWrite(RED_LED, HIGH);  // turn off red LED
  delay(500);
  digitalWrite(GREEN_LED, HIGH); // turn off green LED
  digitalWrite(RED_LED, LOW);  // turn on red LED
  delay(500);  
}

My Arduboy won’t boot if I hold the UP button. No LEDs flashing and the screen remains black. I will try the code another time.

You need to be using a sketch that calls Arduboy.begin(), that contains the ‘flashlight’ mode. Use one of the example sketches.

My sketch uses Arduboy.begin() but still nothing (black screen, no boot) while pressing UP.

Hey hey, do you think you can gist us the code?

http://gist.github.com

This seems to match what you said in the original post:

This is the same command that the library uses to turn on all the RGB LEDs for flashlight mode (the screen should remain black in flashlight mode, as you observed). It’s looking like your Arduboy may have a hardware problem.

@ekem (or anyone else), does flashlight mode work properly on a production Arduboy? It works on my home made system but I don’t have a real Arduboy.

Works perfectly on my red arduboy

2 Likes

I also have this problem.

red led on = blue led
blue led on = red led
green led on = nothing

this is both using the setRGBled and also using digitalWrite

when using the flashlight, I get nothing

this is with my white arduboy that arrived today :slight_smile:

I have a white Arduboy too.

I would have solved this sooner if I could have seen the schematics, BOM, and board files.

With a guess of the pinout for the RGB LED used, I’m almost 100% sure the problem is that the RGB LED has been soldered in upside down (rotated 180 degrees).

This can potentially be caused by having the wrong board file selected? I believe this can happen when you flash as an arduino micro. Check that I might be way off here would like to look deeper in this keep posted!

Just tried this sketch and only the blue LED lights up on my production red arduboy, the board is right so I know it’s not selected as the micro. Seems to be the same problem as @crub

No. The blue LED on the DevKit is on Arduino pin 17. The RGB LED on the production Arduboy is on pins 9, 10 and 11. If you compiled for the DevKit none of the RGB LEDs would ever light using setRGBled().

What happens if you do some analog write directly to the correct pins? Is it just the function? :confused:

I made a truth table of what would happen if the LED was installed rotated 180 degrees. I get exactly the results that are being reported. Only the red and blue LEDs would be able to be turned on and they would be dimmer than normal because there would be 2 dropping resistors in the path instead of one.

It would appear that the second batch of production rotated the rgb led 180 degrees on the pcb. Therefore green cannot work as it is common anode meaning the cathode of the green led is connected to VCC.

Meaning, anyone without speaker holes has a malfunctioning led. This is a sad day for arduboy. Many apologies. I don’t think there is a way to service everyone’s devices. We will just have to live with this mistake and fix it on the next batch.

Maybe we can do a store credit for anyone receiving a faulty unit.

3 Likes

Kev, don’t beat yourself up over it, you have done amazingly well to get it to this stage, some will surely grumble and shout but it’s a minor thing at the end of the day.

1 Like

Well, at least I know now for sure that I did not make a mistake while programming. Arduboy is still a great device and I am going to support the next generation too. I believe you learned a lot during this campaign and I am looking forward for the next project of yours.

So I guess the factory test procedure didn’t include (at least) the RGB LED.

Not only will the green LED not work but in the simple “full on or full off” cases, selecting red will light blue and blue will light red. If you turn on green neither red or blue can be turned on.

The blue and red LEDs will be dimmer than normal because the green LED’s dropping resistor will be added in series. Turning on red will lower the brightness of blue and vice versa.

Controlling the brightness using PWM will work if the green LED is fully off. How PWM brightness control for red and blue will behave, if green is dimmed using PWM, will depend on the phase, frequency and pulse width relationships between green and the other LED.

Here’s the table for the fully on or fully off cases:

RED GREEN BLUE Result
off off off All Off
ON off off Blue
off ON off All Off
off off ON Red
ON ON off All Off
off ON ON All Off
ON off ON Red and Blue
ON ON ON All Off