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.
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
  • WBA ConsultingWBA Consulting Posts: 2,856
    edited 2019-03-11 - 18:59: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
    
    Re-inventing the wheel is not a waste of time if, when you are done, you understand why it is round.
  • 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
    Livermore, CA (50 miles SE of San Francisco)
Sign In or Register to comment.