Quote:
Originally Posted by kepp
I think the question is mostly answered in here already, but just an aside as to coding style...he needs to give useful names to his variables. Just saying x, y, z equals something makes it difficult to follow the logic, even in his own head.
Also (and I've never worked with this Arduino stuff), since he already is setting up the serial port for comms, will Serial.print work as someone suggested? Or will that output over the current serial port link?
|
Yep, Serial.print should work as well. I recommended Serial.println, which simply tacks on a linefeed as a convenience.
When doing Arduino programming and debugging, the serial line is how you write and read data from the device as it is operating. In essence, your IDE compiles down the C++ sketch file into a binary, uploads that over the serial line to the Arduino device, and then resets it. The reset makes it execute your code. The serial connection remains open, and any messages from the Arduino are sent across.