PDA

View Full Version : Code for keyboard imput.



innovator
06-10-2005, 02:43 AM
Hello:

ˇ I'm new in this adventure and I would like to know if a comand exists to perform the following: If a debug is used to ask for a number, what command can be used to retrieve information from the keyboard? and to usethat input to perform basic math function? I'm using a BOEˇBS2 RevC.
Thanks.ˇ Please reply to h.pagan@ieee.org (mailto:h.pagan@ieee.org) or here.

Post Edited By Moderator (Chris Savage (Parallax)) : 6/9/2005 7:49:31 PM GMT

Jon Williams
06-10-2005, 04:28 AM
DEBUGIN will do the trick.ˇ Keep in mind, however, that the keyboard sends characters, you need to use the DEC modifier to filter the input -- in the demo below it accepts the "0" - "9" keys.

' {$STAMP BS2}
' {$PBASIC 2.5}

aNumˇˇˇ VARˇˇˇˇ Byte

Main:
ˇ DEBUGIN DEC1 aNum
ˇ DO WHILE (aNum > 0)
ˇˇˇ DEBUG "*"
ˇˇˇ aNum = aNum - 1
ˇ LOOP
ˇ DEBUG CR
ˇ GOTO Main

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax

allanlane5
06-10-2005, 04:30 AM
Hyperterm can be used on the PC to act as a terminal for the BS2 'DEBUGIN' command.

Or, in the PBasic IDE, the "New Debug" icon (looks like a chip with a magnifying glass over it) can provide the interface.

innovator
06-10-2005, 07:19 PM
Thanks guys.
As soon as I finish my little project I'll get back to you.
pd. wow that was a fast answer