PDA

View Full Version : displaying input values in parallax serial terminal



mikea
03-26-2012, 06:54 PM
I have found how to display text after code lines to monitor them with the serial terminal, but cant seem to locate the right code to display input number values as read from switches ect.
It seems like it starts with "pst.dec......"gangster gadget has a good tutorial on p.s.t., but i didnt see anything in there on the matter of displaying #'s.-mike

MagIO2
03-26-2012, 07:02 PM
dec, bin, hex are available to convert numbers from binary to readable strings. All have a length-parameter which tells the function how many digits to output.

dec length can be 1-10
hex length can be 1-8
bin length can be 1-32

mikea
03-26-2012, 07:45 PM
could you give an example code? right now im trying to read in from a pushbutton on i/o pin 2, the terminal should display a 0 or a 1. what would a line of code look like for that? it doesnt seem to let me reference the pin directly, for example..............pst.dec(ina[2])....... do i need to equate it to a variable?....im kinda lost.-mike

MagIO2
03-26-2012, 08:05 PM
Post the code you have and tell a bit more about the current result!

From not seeing the code you have, the first guess would be that your pin-counting is wrong?! PIN numbers start from 0, so the second PIN has the number 1 and you'd read it using INA[ 1 ].

Otherwise
pst.dec( INA[ 2 ] )
should work.

PS: Had a look into PST and I have to correct what I mentioned first ... dec is the only function which has no number of digits parameter.

mikea
03-26-2012, 08:50 PM
thank you for the help...got it working. i had not put the.......... pst.start(115200).....into the code, among other things