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

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:

float data = 100;
void setup() 

void loop() {

data = data + 1;

data = data - 1;


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?

Please help me.thanks.

The code just send 101,100,101… every second.

Isn’t it sending “101.00,100.00,101.00” ?

Leonardo sketches usually have a piece of code in setup to wait for the Serial port object to be ready.

Is there any difference between the Uno and the Leonardo that cause this problem?

Yes. The two Arduino's have different processors and two different Serial arrangements. The AT328 on the Uno uses a separate TTL serial to USB converter and the 32U4 on the Leonardo has integrated USB.

The connections of the Rx and Tx leds and what they indicate are also very different. There are possible differences in how the serial monitor and the c# text box connect to the usb serial port. The Leonardo(32U4) requires the DTR enable to be set on the computer end.

It's not clear to me what you are expecting to do on the lattepanda, but you may have lots of google work to do on understanding the details of the 32U4 usb serial.

So the leonardo does require the DTR and RTS enable,I enabled dtr and rts on the c# code and it solves the problem, thanks for all the help !

That sketch seems to be missing the declaration of ‘rpm’.

/Users/john/Documents/Arduino/sketch_jun20a/sketch_jun20a.ino: In function 'void loop()':
sketch_jun20a:12:18: error: 'rpm' was not declared in this scope
exit status 1
'rpm' was not declared in this scope