Go Down

Topic: A few errors which I don't understand. (Read 3949 times) previous topic - next topic


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.


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).
The art of getting good answers lies in asking good questions.



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,


Go Up