I am trying to get my Arduino Uno rev 3 to print out to the serial monitor. I am always getting some strange characters instead of what I want to print out.
I have searched and found several similar threads about this but I didn't find any help that worked so far...
I have tried:
-Trying on 2 different computers
-Trying on 3 different OS installations (2 Windows 10 and 1 Fedora Linux, 2 of them were brand new installations and one older Windows 10 installation)
-Trying with 2 different arduino uno boards (one is brand new, prints out weird characters, other is older and does not seem to print out anything so might be more problems with that one...)
-Using 2 different kinds of cables
-Have made sure to match baud rates between arduino code and serial monitor setting, and tried different baud rates
-On Linux checked the baud rates on the serial ports (2 different ones)
-Set baud rate to match the baud rate set in OS
-Changed baud rate to 9600 everywhere
-Made sure I had selected Arduino/Genuino Uno for the board (is this right or am I mistaken?)
INTP:
If you are using clone boards, do you have the proper drivers if they use a different USB chip (CH340 instead of 16U2)
I'd imagine that the driver would have to be right for the code to upload without problems.
(I'm assuming that it is uploading OK, but that hasn't actually been stated.)
I put in a delay, is this how you ment? Or in the loop before the rest of the code?
Sorry for not mentioning this, but I am using the standard arduino IDE and trying to print to it's serial monitor.
I was first using a clone board but bought a genuine one to rule out that it was some kind of problem related to a clone board, I can check if the old one has the right drivers...
If windows autofound a close-enough driver then how come I get the same problem using Linux?
I guess the boards might be corrupted but one was brand new and had this problem from the start.
I will look into reflashing them if nothing else works...
INTP:
Just grasping at straws, since everything seems in order.
Maybe windows autofound a close-enough driver that sort of works but not quite.
Yeah, possible, but if it can upload without problems, with two-way communications at a high baud rate, you'd think a simple one-line print at a low baud rate, (or any baud rate), would work.
Maybe boards are corrupted and need to be reflashed.
Something definitely ain't right. Two computers, 3 OS, two Arduino boards, (although one might be dead, since it prints nothing), two USB cables, uploading is fine.
It must be Gremlins.
N.B. @sheurwp , there definitely isn't anything wrong with the code. (But I'm sure you already know that.)
Sometimes if the baud rate in the program does not match the baud rate on the serial monitor, either junk appears or, sometimes, nothing appears. I'm assuming the baud rates match.
I found some very strange behavior, I tried doing the blink example. The LED was blinking before I compiled the sketch (have it plugged to pin 13 and ground). Now when I compile the sketch it compiles successfully, but changing the delay values to higher values like 5000 seems to have no effect. The LED just blinks at the same rate so it does not seem like it is running the compiled code.
Also if I check the serial monitor then it prints out some weird characters again, just like before. So it seems I could never get any code to run on it, it just has the same behavior.
I am plugging in with USB directly, not through a hub or FTDI.
My native language is swedish so I have keyboard set to swedish but operating system is in english because I find that easier for following guides and such that are in english anyway.
@econjack
Yes have matching baud rates, have tried unmatching them as well to see if there there was some kind of clock issue that would offset the baudrates somewhat, but found no effect from that.
On linux I checked what the operating system had set the baud rate to, and then matched that in arduino code and in the serial monitor. Have also tried changing that operating system baud rate to 9600 and then used 9600 everywhere. Had no effect on the issue.
sheurwp:
Now when I compile the sketch it compiles successfully, but changing the delay values to higher values like 5000 seems to have no effect. The LED just blinks at the same rate so it does not seem like it is running the compiled code......So it seems I could never get any code to run on it, it just has the same behavior.
So it's not uploading correctly, by the sound of it. Do you get a "Done uploading" message shortly after pressing the "Upload" button in the IDE?
OldSteve:
So it's not uploading correctly, by the sound of it. Do you get a "Done uploading" message shortly after pressing the "Upload" button in the IDE?
Well that is a bit embarrassing but I was just pressing the verify button and not the upload button. The weird text that the serial monitor was printing out got me thinking in the wrong direction to start.
If I now also upload the sketch then the serial monitor prints out the text that I want .
sheurwp:
Well that is a bit embarrassing but I was just pressing the verify button and not the upload button. The weird text that the serial monitor was printing out got me thinking in the wrong direction to start.
If I now also upload the sketch then the serial monitor prints out the text that I want .
I started to suspect that might have been the problem, when you said "Now when I compile the sketch it compiles successfully, but changing the delay values to higher values like 5000 seems to have no effect.".
Not to worry, all's well that ends well.
sheurwp:
Well that is a bit embarrassing but I was just pressing the verify button and not the upload button. The weird text that the serial monitor was printing out got me thinking in the wrong direction to start.
If I now also upload the sketch then the serial monitor prints out the text that I want .