Arduino uno q pwm pins disabled

I'm trying to use pwm pins in the arduino uno q board as I usually do in other arduino boards, and when I try the analogWrite() function the output voltage level is 0V, even with a analigWrite( ,255). But when I run the digitalWrite High in the same pin its level is 3.3V so I don't know what to do to use the pwm pins with the analogWrite() as it seems that it's not working on the board or that it's unconfigured. I'll be greatfull if someone can help me.

Hi @nicolasgallego13. Please share your sketch code in a reply here on this forum topic.

#define 6 pwm
#define 8 in1
#define 8 in2

void setup() {
  // put your setup code here, to run once:
  pinMode(pwm,OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(pwm, 0);
  delay(1000);

  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(pwm, 128);
  delay(1000);

  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  analogWrite(pwm, 255);
  delay(1000);

  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(1000);

}

I even tried only defining the pwm pin, and sending some signals as 128, 255. But when I measured the voltage with the multimeter it always stayed on 0V. Only using digitalWrite on the objetive pin its voltage changed to 3.3V when HIGH.

Remove this line from your sketch:

Then upload the updated sketch to the board once again. Hopefully this time it will work as expected.

Unfortunately due to a quirk in the "UNO Q Board" platform, pinMode is currently incompatible with analogWrite. analogWrite takes care of configuring the pin appropriately for PWM, so the pinMode call would be superfluous anyway. You should only use pinMode when using the pin as a standard input or output.

yep, it worked. I really apreciate it, thank you so much.

You are welcome. I'm glad it is working now.

By the way, the Arduino developers are aware of this poor user experience and there is an existing proposal for a fix:

So hopefully the pinMode incompatibility will no longer be a problem at some point in the future. However, pinMode will remain superfluous when using analogWrite even after that proposed change, so the code you have now will continue to work regardless.