Serial.println() not working properly on Arduino Leonardo (LattePanda)

userHead DTA1999 2020-07-02 07:10:08 1879 Views1 Replies
Firts of all, sorry for my poor English.
I'm try to send data from arduino leonardo (attach on lattepanda) to c# winform using Serial.println().
Here the code:

Code: Select all

float data = 100; void setup() { Serial.begin(9600); } void loop() { data = data + 1; Serial.println(rpm); delay(1000); data = data - 1; Serial.println(rpm); delay(1000); } The code just send 101,100,101... every second.

The c# code i just simply using Serial.ReadLine() to read the data and send to a text box.When i test on my arduino Uno, it working fine.But when i use the Leonardo on lattepanda, here the problem: When i upload the code and open the Serial Monitor, it still send 101,100... like the Uno, and the led still blinking every 1 second to show that the data is being sent. But when i TURN OFF the Serial Monitor, the led is not blinking any more, and when i open the c#, the text box doesn't have anything( remind you that i tried it on arduino Uno and it work so i don't think the code is the problem).

Is there any difference between the Uno and the Leonardo that cause this problem,or it's a lattepanda problem?

Please help me.thanks.