Shop OBEX P1 Docs P2 Docs Learn Events
displaying input values in parallax serial terminal — Parallax Forums

displaying input values in parallax serial terminal

mikeamikea Posts: 283
edited 2012-03-26 13:50 in Propeller 1
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

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2012-03-26 12:02
    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
  • mikeamikea Posts: 283
    edited 2012-03-26 12:45
    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
  • MagIO2MagIO2 Posts: 2,243
    edited 2012-03-26 13:05
    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.
  • mikeamikea Posts: 283
    edited 2012-03-26 13:50
    thank you for the help...got it working. i had not put the.......... pst.start(115200).....into the code, among other things
Sign In or Register to comment.