Hi all,
I'm yet another novis to the world of electronics, I was wondering if there is any way I could read the voltage on my project board and display it on my OLED. Ive tried readadc, then tried to alter values but it,s doing my head in.
Welcome to the forum. It would help if you could post your attempted code for it to be
nitpicked corrected.
However, a common mistake to check for is failure to convert a variable into ASCII characters for display on the OLED, in which case your existing code might use
serout C.0,N2400,(254,128,"Voltage = ",b0). If this is the case then read on.
There are two ways of doing ASCII conversion - the easiest is simply to precede the variable with a # and to put two spaces afterwards:
serout C.0,N2400,(254,128,"Voltage = ",#b0). This method does not produce leading zeroes.
The second way is to use the
bintoascii command and this way uses more variables but is ideal if you want leading zeroes or want to insert a decimal point. Example:
bintoascii b0,b1,b2,b3
serout C.0,N2400,(254,128,"Voltage = ",b1,b2,b3)
Example with decimal point:
bintoascii b0,b1,b2,b3
serout C.0,N2400,(254,128,"Voltage = ",b1,b2,".",b3)
P.S. When posting more than a couple of lines use [CODE][/CODE] tags.