I'm trying to debug a problem and hope someone here can help. In the following code the second loop in loop() doesn't execute:
/*
Fading
This example shows how to fade an LED using the analogWrite() function.
The circuit:
* LED attached from digital pin 9 to ground.
Created 1 Nov 2008
By David A. Mellis
modified 30 Aug 2011
By Tom Igoe
http://www.arduino.cc/en/Tutorial/Fading
This example code is in the public domain.
*/
int ledPin = 23;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop()
{
for (uint8_t fadeValue = 0 ; fadeValue <= 255; ++fadeValue)
{
Serial.println(fadeValue);
analogWrite(ledPin, fadeValue);
delay(90);
}
for (uint8_t fadeValue = 255 ; fadeValue >= 0; --fadeValue)
{
Serial.println(fadeValue);
analogWrite(ledPin, fadeValue);
delay(90);
}
}
I've tried this with both a Teensy and Arduino Nano. This effort was with the Teensy, which is why the pin number was chosen. For the Nano, I checked the pinout from http://marcusjenkins.com/wp-content/uploads/2014/06/nano.pdf to be sure I used a PWM capable pin.
Anyone see what I'm doing wrong?
Thanks
Joe