analogWrite freezes the board

ello, when I try to run any code that has an analogWrite(x,x); in it, it compiles but the code won't run. Even if my code is not going trough it, if it is present in the code, the code is not starting.
any insight on what the problem could be ?

The board is an Arduino DUE

This won't work, test will not print

Serial.print(" test");

but this is working, test is printed correctly:

  Serial.print(" test");


Did you try pinMode(11, OUTPUT); in your setup?

Did you try
pinMode(11, OUTPUT);
in your setup?

Exactly why we like to see ALL the code. But will not setting the pin to an OP kill the program?


Yeah, everything is set. I'm 100% sure it's not about the code because it is working fine on my friend's arduino

Firstly, delete/uninstall the Arduino IDE, re-download it and reinstall it.

Then try running the Basics->Fade example with an LED+resistor connected to pin 9 and GND. Does it work?

Nope, it compiles but it just seems to push nothing to the arduino, or the arduino can't handle it

Hello jdorval,
Which IDE version you are using? 1.5.5-r2 or older?
Also, could you run the following code to see if the built-in led L (amber) fades?

const int ledPin = 13;

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

void loop() {
  for (int brightness = 0; brightness < 255; brightness++) {
    analogWrite(ledPin, brightness);
  for (int brightness = 255; brightness >= 0; brightness--) {
    analogWrite(ledPin, brightness);