Go Down

Topic: analogWrite freezes the board (Read 611 times) previous topic - next topic

jdorval

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
 
Code: [Select]

Serial.print(" test");
 analogWriteResolution(8);
 analogWrite(11,100);
 



but this is working, test is printed correctly:

 
Code: [Select]

  Serial.print(" test");
  analogWriteResolution(8);
  //analogWrite(11,100);
 


herter

Hello,

Did you try
Code: [Select]
pinMode(11, OUTPUT); in your setup?

Graynomad

#2
Feb 19, 2014, 10:44 am Last Edit: Feb 19, 2014, 10:47 am by Graynomad Reason: 1
Quote
Did you try
Code:
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?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

jdorval

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

stimmer

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?
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

jdorval

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

Palliser

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?

Code: [Select]
const int ledPin = 13;

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

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


Regards,
Palliser

Go Up