Pages: [1]   Go Down
Author Topic: Problems with serial Print syntax  (Read 420 times)
0 Members and 1 Guest are viewing this topic.
Colorado
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino F@#$%*g  ROCKS
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my code to print LF= then insert the random number
Serial.print("LF=", randNumber1);
But I get this error Invalid conversion from 'const char*' to 'long int'
I could switch the variable to short or int but I don't think that is the problem.  Probably a very simple fix that I'm not seeing.

Thanks Steve
Logged

London
Offline Offline
Faraday Member
**
Karma: 10
Posts: 6249
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the fix is:
Serial.print("LF=");
Serial.print( randNumber1);
Logged

Colorado
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Arduino F@#$%*g  ROCKS
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks that was too simple.  I guess I was trying to reduce the program size.  

Thanks Steve
Logged

London
Offline Offline
Faraday Member
**
Karma: 10
Posts: 6249
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are some C++ tricks you can use to print more then one value in a single line of source code, but that doesn't reduce the size of the runtime code and it can be confusing if you are not familiar with C++

You can read more in this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231224786/all
Logged

Pages: [1]   Go Up
Jump to: