Using Parallax Serial Terminal to output multi-column ADC numbers
robotics
Posts: 90
Hi,
When I output adc values (0-255) from a sensor using the Spin Parallax Serial Terminal using the following code, the original and continually updated adc readings appear fine:
pst.Position(0,0)
pst.Dec(adc_reading_1)
pst.ClearEnd
When I want to place another adc reading to right of the first output (ie, in a second column) using the following code, the numbers for the first adc get mangled as the adc values change due to the
number of digits changing and the lack of the pst.ClearEnd command after the first adc reading.
pst.Position(0,0)
pst.Dec(adc_reading_1)
pst.Position(15,0)
pst.Dec(adc_reading_2)
pst.ClearEnd
Best way to handle this please as I would like to have 2 columns of streaming data.
Thank you
When I output adc values (0-255) from a sensor using the Spin Parallax Serial Terminal using the following code, the original and continually updated adc readings appear fine:
pst.Position(0,0)
pst.Dec(adc_reading_1)
pst.ClearEnd
When I want to place another adc reading to right of the first output (ie, in a second column) using the following code, the numbers for the first adc get mangled as the adc values change due to the
number of digits changing and the lack of the pst.ClearEnd command after the first adc reading.
pst.Position(0,0)
pst.Dec(adc_reading_1)
pst.Position(15,0)
pst.Dec(adc_reading_2)
pst.ClearEnd
Best way to handle this please as I would like to have 2 columns of streaming data.
Thank you
Comments
If you want the display nice and neat, then you'll want to use a string formating object like the one included in several of the attached archives in this thread. (I'd try the first attachment to post #1.)
The name of the object I commonly used (and which should be included in the above linked thread) is "strfmt.spin". I think there is also a "numbers" object included with the Propeller library which should help you in this matter. You will want to use one of the methods with will pad the number displayed with spaces. I don't recall the names of these methods off hand.