Help, serial monitor when reading voltage


I have no clue whats causing this

That'll be the Serial.write.

Please remember to use code tags when posting code.

(Your code is way too big,BTW)

Serial.write() just sends out the data you pass directly. (e.g. 10 gets sent as 0x0A or '\n' or linefeed)
Serial.print() converts numbers into their ASCII representation (e.g. 10 gets sent as '1', '0')

and Serial.println() adds a newline '\n' after its output

And in the IDE monitor, it tries to display the 'character' equal to that number,
see the ascii table
Now if you write the byte 45decimal == 0x2D the monitor will display '-'
But for bytes below 32 and above 127 to 255 you will see odd characters.
Finally write() only writes 1 byte (the lowest byte) of the multibyte int v and that will jump around due to noise.
So as stated above use
Serial.print(v); instead to convert the v bytes to chars bytes before sending them

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.