Pages: 1 [2]   Go Down
Author Topic: A few errors which I don't understand.  (Read 1854 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want to have them be ints, declare them as ints at the start rather than bytes.

For the incorrect line numbers, that is because the arduino language adds some stuff to the beginning before it ships it off to gcc (the compiler). Usually it manages to get the line numbers correct (I have no idea how), but if it says the error is in *.cpp, it'll get them wrong.

If you press shift while compiling (not uploading), you can see where it puts the files. If you go there and open up <yousketch>.cpp, you can see what it does. You could also use a "#line 10" (replacing 10 with the real line number) at about the beginning of setup() (that's where it adds the extra lines). Play around with it if you care.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 644
Posts: 50524
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Int(..) plays the role of converting byte...
Yes, it does. This means that int() has an input (the value in the parentheses) and an output, which you discard. It also means that it is an rvalue (can only appear on the right side of an equals sign), so you can not use at as an lvalue (something that can appear on the left of an equals sign).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay,

I'll look in to your advise WizenedEE. It seems very helpful.
And PaulS, I understand what you are saying now. Sometimes I don't (completely) get it the first time.

Thanks so far,

ATIP
Logged

Pages: 1 [2]   Go Up
Jump to: