Go Down

Topic: What am I doing wrong? Silly mistake? (Read 623 times) previous topic - next topic

sbright33

I know pin 3 output is working...
This works as expected measuring with LED or voltmeter:

Code: [Select]
void setup() {
pinMode(3,OUTPUT);
digitalWrite(3,HIGH);
delay(2000);
digitalWrite(3,LOW);
delay(2000);
digitalWrite(3,HIGH);
delay(2000);
digitalWrite(3,LOW);
delay(2000);
}
void loop() {}


I have modified this demo a bit, 3 -> 333, and moving the delay
I did this as a test to see if I can measure the output on pin 3 with LED or voltmeter
Nothing.  It's stuck at 0V.
Am I losing my mind?
Please help!

Code: [Select]
/*
* IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
* An IR LED must be connected to Arduino PWM pin 3.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
IRsend irsend;
void setup()
{
}
void loop() {
 if (Serial.read() != -1) {
   for (int i = 0; i < 333; i++) {
     irsend.sendRC5(0x01, 12);
     //delay(100);
   }
 }
delay(5000);
}


Edit:
I figured it out as soon as I posted it.
Go ahead laugh at me!
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

robtillaart

Quote
Go ahead laugh at me!

Why should we laugh at someone who definitely is learning from his/her mistakes?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

sbright33

It's funny how the problem is right in front of your eyes, but you can't see it...
Now it works wonderfully at controlling the TV!
When you press a key.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Njay

The transmission code is inside an 'if' statement, which means it will only run if the 'if's condition is evaluated to true. The condition, "Serial.read() != -1", is only true when arduino gets a character from the serial port (or, saying another way, when "someone" sends a character to arduino through the serial port).

sbright33

You win a prize! 
It took me nearly an hour to figure that out.
I bet you got it immediately...
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Go Up