A
A
Alexander Nikulshin2021-01-20 23:34:36
Arduino
Alexander Nikulshin, 2021-01-20 23:34:36

How to work with Serial on Arduino DUE?

I wrote a simple sketch for transmitting a string to a PC via Serial:
https://qna.habr.com/#

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("fdf");
  delay(100);
}


I connect Arduino DUE through Native port. But in the port monitor there are no messages from MK. Tell me what am I doing wrong? Or a problem with the board (bought on alliexpresse)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kalapanga, 2021-01-21
@kalapanga

I have never had a DUE. But, judging by the documentation, you can communicate with the arduino through the Programming port. It is he who corresponds to the "Serial" object. The native port is the "SerialUSB" object.
https://www.arduino.cc/en/Guide/ArduinoDue

N
nochkin, 2021-01-26
@nochkin

I would check the port on the PC side. Maybe just the wrong port is selected.
The same Arduino IDE has its own console for the serial port.
There are also TX/RX LEDs on the board. One of them should flash when executing Serial.println. You can use them to check that the program is running.
I read a little about DUE here: https://www.arduino.cc/en/Guide/ArduinoDue -- there is a "Native port" section.
It is recommended to add the following to "setup" before using the port:
while (!Serial) ;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question