Shop OBEX P1 Docs P2 Docs Learn Events
Help with Keyboard Input — Parallax Forums

Help with Keyboard Input

I'm running the Propeller Tool on my laptop. It's connected to the Prop with a PropPlug.

I want to be able to read the laptop keyboard when typed in to the input bar at the top of the tool.

Which library routine should I use to do this. I should know, but it's been too long since I did it.

Thank you for your help!

Jim

Comments

  • I always use Parallax Serial Terminal.
  • WBA ConsultingWBA Consulting Posts: 2,933
    edited 2019-03-11 18:59
    The standard "Parallax Serial Terminal.spin" object does that. Within the Propeller Tool you can find the Propeller Serial Terminal Demo.spin program under the "Propeller Library - Demos" folder. Also, under Help in the Propeller Tool, you should be able to open the Propeller Education Kit pdf which covers some PST usage starting on page 102.

    What you are looking for specifically, is on page 106 and uses the "EnterAndDisplayValues.spin" code from the PE Kit folder.
  • Hi Tom,

    Thank you for the feedback. I AM using the Parallax Serial Terminal.

    Can you give me a simple example of how to read the input from this into a spin program?

    Thank you!

    Jim
  • WBA provides some links above, and the short answer is
    ascii := pst.rx
    
  • Thanks for your help. I figured it out myself. Now I feel dumb. :) Too easy...

    Jim
  • mynet43 wrote: »
    ...I AM using the Parallax Serial Terminal.
    Can you give me a simple example of how to read the input from this into a spin program?
    You may want to use PST's CharIn as it will wait for input (Rx may not)
    '
    ' Character input Example, using Parallax Serial Terminal
    '
    OBJ
    
      pst : "Parallax Serial Terminal"
      
    VAR
    
      byte x
    
    PUB Main
    
      PST.Start(115200)  ' baud rate on default UART pins
      PST.Str(string("Starting..."))
      PST.NewLine
      PST.NewLine
    
      repeat
          x := PST.CharIn       ' wait for character to be typed
          PST.Str(string("Character typed: "))
          PST.Char(x)
          PST.NewLine
    
    dgately
Sign In or Register to comment.