Hi @Klausj
When I'm having trouble with serial output, I like to do a quick check with the most simple possible sketch. If this works, then I know the problem has something to do with my real sketch. If it doesn't work, then I know the problem is not related to my sketch code. It seems maybe a little silly, but it allows me to be sure I'm focusing my troubleshooting efforts in the right direction.
Try uploading this sketch to your Arduino board:
- Copy and paste this code as a new sketch in Arduino IDE:
void setup() { Serial.begin(9600); } void loop() { Serial.println("hello"); delay(1000); }
- Upload the sketch to your Arduino board.
- Select Tools > Serial Monitor from the Arduino IDE menus to open the Serial Monitor view if it is not already open.
Do you now see the word "hello" being printed in the Serial Monitor's output field once a second?
That is correct, as explained here:
https://docs.arduino.cc/tutorials/uno-r4-minima/cheat-sheet#usb-serial--uart
On the UNO R3, the UART of the primary ATmega328P microcontroller is connected both to pins 0 and 1 and to the USB to serial adapter chip (ATmega16U2).
The Renesas RA4M1 microcontroller of the UNO R4 has native USB capabilities, so no additional "bridge" USB to serial adapter chip is needed. The RA4M1 is connected directly to the USB socket on the board and produces a USB CDC serial port on the PC that is connected to the USB cable. The separate hardware UART on the RA4M1 is connected to pins 0 and 1 on the UNO R4. You must use the Serial1
object instead of Serial
in order to do communication via pins 0 and 1.
Although it may be confusing to those who are accustomed to the hardware design of the UNO R3, this difference is actually an improvement in the UNO R4 because it means you can use pins 0 and 1 freely without interfering with communication between the board and your computer. Connecting arbitrary circuits to those pins on the UNO R3 is a common cause of mysterious upload failures for beginners.
No.