Reverse behavior of on-board LED3_R (LED_BUILTIN) of UNO Q

Hi Arduino Forum,

I have a copy of the Uno Q and tried the sketch posted here:

it compiles and downloads correctly. The result is backward/reverse behavior from what is expected on my Uno Q built-in LED when I change the timing. Changing delay for HIGH from 500 to 1500 results in the LED OFF for 1.5 sec and ON for 500 ms. I have seen this shown on YouTube also (Top Tech Boy, Paul Mc..) on his review of Uno Q. Also, with no configuration of an external LED can I make it fade as given in the Examples> Basic> Fade . The external LED is proven to work using V and Gnd directly. I have tried pins 9, 12, and A1 . Fade does not work on Uno Q. Also, I cannot get servo to respond and control any servo motor in my kits. I have uninstalled the board in manager and reinstalled it, using the standard Arduino IDE. The Uno Q is advertised to work with the IDE on both Amazon and Arduino sales site (where I bought my Arduino Uno Q 4GB version.)

Search this doc for LED_BUILTIN
https://docs.arduino.cc/tutorials/uno-q/user-manual/

Do you have an Arduino Uno Q board in hand ? If so try the blink sketch and see the results that I am talking about; backward result. If not, then why are you commenting ?

Did you see this from the manual?

void set_led_state(bool state) {

// LOW state means LED is ON

digitalWrite(LED_BUILTIN, state ? LOW : HIGH);

}

So, you need to write a LOW for the LED to be on, and HIGH for off.

HTH

Hi @FrankSchmidt.

It is easy to get the impression that HIGH means "on" and LOW means "off". However, this is incorrect. The effect of the pin state on a circuit depends on how that circuit is configured.

Here we have an example LED circuit in one possible configuration:

In this case, when pin 2 is set HIGH, current will flow through the LED and it will turn on, as you expected. This is referred to as an "active HIGH" configuration.

Now consider this alternative, and equally valid, configuration for the example circuit:

In this case, when pin 2 is set LOW, current will flow through the LED and it will turn on. This is referred to as an "active LOW" configuration.

The LEDs on the UNO Q have an "active LOW" circuit configuration. So the behavior you observed is expected. This is actually the case on several Arduino boards.

Something that might make it easier for you to work with the LEDs is to define some convenience variables in your sketch:

byte ledOnState = LOW;
byte ledOffState = HIGH;

Then you can write self-documenting code like this:

digitalWrite(LED_BUILTIN, ledOnState);

Because, I read the document, and posted the link so that you could read the document.

@ptillisch have already explained this in detail.

LED_BUILTIN on Arduino Uno Q is LED 3, LED3_R (Red) to be specific.

LED 3 and LED 4 are RGB LEDS and MCU controlled. These LEDs are active low, this means they turn ON with logic '0'.

HIGH means turn the LED on–your own documentation says so.

@FrankSchmidt yes it does state here that 'High' means 'On' that is Active High Logic. But As explained earlier the LED_BUILTIN on Arduino Uno Q follows Active Low Logic. This is counterintuitive and could create confusion.

You could create two consts LED_ON and LED_OFF with active low logic for LED_BUILTIN just for simplicity.

#define LED_ON  LOW
#define LED_OFF HIGH

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}


void loop() {
  digitalWrite(LED_BUILTIN, LED_ON);
  delay(3000);                      
  digitalWrite(LED_BUILTIN, LED_OFF);   
  delay(1000);                   
}

You are reading documentation for a "Not the Uno Q" See Post #2.

Thanks for bringing this to our attention! I have corrected the erroneous comments in the "Blink" sketch:

The fix will be in the examples bundled with Arduino IDE starting from the next release:

@FrankSchmidt

UNO Q represents a remarkable migration from the UNO R3 platform. However, in the UNO Q board design, the onboard LED (LED_BUILTIN = LED3_R, lebeled STM-3) is implemented using active-LOW (negative) logic, meaning the LED turns ON when its cathode terminal is pulled LOW (Fig-1).

In contrast, on the UNO R3, the LED_BUILTIN is implemented using active-HIGH (positive) logic, where the cathode is permanently grounded and the LED turns ON when a HIGH level is applied to its anode terminal.

Since LED_BUILTIN on the UNO Q is not driven from header pin D13, the board designers likely had valid architectural or electrical reasons for choosing an active-LOW configuration in this case. It is worth noting that all header GPIO pins on the UNO Q continue to follow positive logic, consistent with the behavior of the UNO R3 header pins.

image

Figure-1:

How about fixing “Fade” also ? That’s offered under “basic” sketches when I install UnoQ board and it doesn’t work either. Because there are so many failed Arduino sketch offerings under Examples > Basics, I haven’t even bothered to go further down the list . Again, speaking to the consumer Arduino/Qualcomm has said flatly that all the standard Arduino sketches work with Uno Q (both on Arduino sales site and on Amazon) and this is clearly not true. Expect blowback from consumers.

There is some work to fix it here:

I think that approach of changing the core code so that the existing example works will be the best approach.

For now, please comment out this line in the sketch to make it work with the UNO Q:

pinMode(led, OUTPUT);

You should only use pinMode to configure the pin as OUTPUT in the case where you are using digitalWrite.

There are four 3-color RGB LEDs on the UNO Q board (QBR: 1 and 2; STM: 3 and 4). I attempted to mix and modulate their colors at different duty-cycle percentages; however, I was unsuccessful because the analogWrite() function does not work for these LEDs, even though it functions correctly on DPins 3, 5, 6, 9, 10, and not on 11).

Try to do it with Servo library, it seems it can emulate fading using software timers

Servo.h Library is not supported by STM32U585 MCU of UNO Q board. I tried and got the following compilation error.

77 | #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."

Hi @GolamMostafa. Which version of the "Servo" library do you have installed? Support for the "Arduino UNO Q Board" platform was added in version 1.3.0:

So it seems you are using an outdated version of the library.

I have now installed V 1.3.0 and no more compilation error. However, the intensity of LED4_G does not modulate. The LED4_G remains On all the time. This is the sketch I have uploaded in IDE 2.3.7.

#include<Servo.h> //V 1.3.0
Servo myServo;
#include<Arduino_RouterBridge.h>
byte i = 0;

void setup() {

  myServo.attach(LED4_G);

}

void loop() {
myServo.write(i);
delay(200);  

}