I know I must be doing something wrong here. I just cant seem to get Serial I/O working. Based on the example on the Arduino site I ran this code, and nothing happened.
My method is I Verify the program, then upload it to the board, and then start up the serial monitor.
Attached is a screen shot. When I run the second case with the constant "HelloWorld" print in the loop, I noticed the TX LED on the board was on. I started up serial monitor again, and there was garbage.. I then I had to press a few keys cant remember which though. I think I had to press enter, or press "send" a few times until it started printing a whole stream of "HelloWorld"
With the first case, I tried restarting serial monitor, and when I send data, I can see the "RX" LED flicker, but nothing from TX.
I am on Windows 7 64bit. That shouldnt be a prob?
Is there a certain procedure to run serial monitor?
char inByte; // incoming serial byte
void setup() {
Serial.begin(9600); // serial communication baud rate
Serial.println("hello World");
}
void loop() {
// while loop begins here, continous loop:
if (Serial.available()) { // check for incoming data --> if available
inByte = Serial.read(); // store incoming data
Serial.print(inByte); // echo back the data
}
}// while loop ends here
void setup() {
Serial.begin(9600); // serial communication baud rate
Serial.println("hello World");
}
void loop() {
// while loop begins here, continous loop:
if (Serial.available()) { // check for incoming data --> if available
inByte = Serial.read(); // store incoming data
Serial.print(inByte); // echo back the data
}
}// while loop ends here
It worked for me.
thanks for that solidsnake...it works like magic! the weird thing is, after i upload your code, i then start serial monitor...then i have to wait for a few minutes or press enter/send several times until the first "helloworld" comes up..then it works perfect.
whats wrong with my code and why wont that work?its identical, except for the initial serial print after setting it..