Shop OBEX P1 Docs P2 Docs Learn Events
General questions about using the KEYBOARD object and a VGA display — Parallax Forums

General questions about using the KEYBOARD object and a VGA display

ElectricAyeElectricAye Posts: 4,561
edited 2009-05-09 22:35 in Propeller 1
Hi all,

Ultimately what I would like to do is change the values of about 6 variables that I have displayed on a VGA.· At first, I thought about using a cursor to click on buttons to raise or lower the values, but then Mike Green mercifully warned me that I might run out of memory for my application because of button graphics, etc.· So now I'm looking at the possiblity of using a keyboard.· How difficult would it be to use a keyboard to simply tab from one value to another and type in new values?· Is that something that could be done with a single cog and very little memory,·or is that a MCMH (Multi-Cog Memory Hog)???

Also, directions to SPIN·code examples on how to implement a keyboard are guaranteed to gain you some big points on the Karma Wheel of Fortune.·

thanks,
Mark
smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Watching the world pass me by, one photon at a time.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-08 21:02
    There's no reason why you can't use a mouse, just don't use graphics for the buttons. Use characters. You can easily translate the pixel coordinates of the mouse to character coordinates since each character tile is usually 16 x 32, then just set the sign bit of the text character to the mouse button setting to invert the colors shown (foreground <-> background) when the mouse button is clicked. You'd have a table with the text coordinates of the button and you can easily check to see what the text coordinates of the button are (and what routine need to be executed, perhaps to increment or decrement a specific value.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-05-08 21:34
    Mike Green said...
    There's no reason why you can't use a mouse, just don't use graphics for the buttons. Use characters. ....
    Oh, okay.· I didn't know I could do that.· I think I'm beginning to understand how to approach this now.·

    thanks again,
    smile.gif·smile.gifsmile.gif
  • RaymanRayman Posts: 14,827
    edited 2009-05-08 22:18
    The things you're asking for are a lot like what I've done here:
    http://www.rayslogic.com/propeller/Programming/BasicWindowForm/BasicForm.htm

    Also, that "Delay Generator" app is a bit more advanced and lets you change numbers with the mouse...

    Admittedly though, it may be hard for a beginner to follow, but I think you'll see how to do it...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • localrogerlocalroger Posts: 3,452
    edited 2009-05-08 22:42
    The keyboard is really simple to use, but takes two cogs, one for the driver and one for the Spin control logic you write. Look at the keyboard.spin object that came with the proptool. Once you start it, from another object (whatever is doing user interface housekeeping, it can be the same object/cog that updates the display values) occasionally check the value of key.key; if it's not zero, process the key. Scroll down to deep in the scary PASM green for a list of key codes, including all the arrow and control keys. It should take about 50-100 lines of Spin to implement an interface that lets you arrow to the entry you want, press ENTER, and edit it with backspace, etc. For just a few values I'd much prefer this to the mouse, and it is much simpler to implement (if you use a mouse, you will probably need the keyboard TOO to do value entry, or a much more complex interface to put a keypad on the display people can click on).
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-05-09 04:13
    To Rayman and localroger,
    thanks for your suggestions on this. As usual, it will take me a considerable amount of time to absorb how this works.

    To localroger,
    I love your phrase "...deep in the scary PASM green..." smile.gif

    cheers to all,
    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Watching the world pass me by, one photon at a time.
  • localrogerlocalroger Posts: 3,452
    edited 2009-05-09 22:35
    @ElectricAye -- We have all been there, brother. It's only scary until you understand it. And the way you understand it is to use it.
Sign In or Register to comment.