Hello,
I'm currently developing a small project thats using pretty much every pin on the output side. Therefore, I don't have the possibility to change pins.
Anyway, I'm getting a constant output voltage (~2V) from a PWM pin (pin 6), even when it's output value in the code is 0 (zero).
For example, let's say I have something like this:
const int Pin1 = 5;
const int Pin2 = 6;
void setup()
{
Serial.begin(9600);
pinMode(Pin1, OUTPUT);
pinMode(Pin2, OUTPUT);
}
void loop()
{
for(int i = 0; i < 256; i++)
{
analogWrite(Pin1, i);
analogWrite(Pin2, i);
delay(10);
}
for(int i = 255; i > 0; i--)
{
analogWrite(Pin1, i);
analogWrite(Pin2, i);
delay(10);
}
}
Now, while this is running, I can measure the output voltage on each pin (while driving a 3.3V led) and get between (0 - 3.3V) on Pin 5, and between
(~2 - 3.3V) on Pin 6.I've changed arduino boards, while maintaining the ATMEGA328 chip, and get the same result.
I haven't been able to test with another chip because I have no other one that can be programmed (the other one I have keeps giving an upload error - but thats for another post).
I'm guessing that there might be a problem with the pin on the ATMEGA chip corresponding to pin 6 on the board.
Is this right? is There something else I can do? I really need to use that pin to control LEDs, and it won't look properly if one of them doesnt turn off when it's supposed to...
Any thoughts?