I THINK I FOUND IT!!!
When you use PWM, you turn it on like this
analogWrite(1, 1000); analogWrite(0, 1000);
In this case, only led 1 turns on...
I thought it was the processor that coudn't handle it. so i change it to this:
analogWrite(1, 1000); delay(1); analogWrite(0, 1000);
Guess what, both leds turned on!!
void setup() { // nothing for setup } void loop() { analogWrite(1, 1000); delay(1); analogWrite(0, 1000); delay(200); analogWrite(1, 0); delay(1); analogWrite(0, 0); delay(200); }
DAMN, i tried this code:
void setup() { } void loop() { analogWrite(0, 255); delay(1); analogWrite(1, 255); delay(1); analogWrite(2, 255); delay(1); analogWrite(3, 255); delay(1); analogWrite(4, 255); delay(1); analogWrite(5, 255); delay(1); delay(1000); analogWrite(0, 0); delay(1); analogWrite(1, 0); delay(1); analogWrite(2, 0); delay(1); analogWrite(3, 0); delay(1); analogWrite(4, 0); delay(1); analogWrite(5, 0); delay(1); delay(1000); }
And it did not run like it should... Led 0 stays on... (actually, I ran that code with just 3 leds, on pin 0,1,3.
when i try the same code on the leds 1,2,4, it works aswell, just like 2,3,5)
It seems that only pin 0 stays on.)
It seems to me, that there is a little bug in the software, instead of the hardware,
Why would my first program work, and my second not. But then again, why would only pin 0 stay on..?
I hope this helps.
Anyway, if you sacrefice PWM pin 0, you it will work. i think.
@Barragan, could you help us out?
Titus
@Eustace Don't give up!, we can do it!
Check www.TeamVossius.nl for our Autonomous soccer robots!
IP Logged
|