View Full Version : KEYBOARD Input
09-19-2008, 02:33 AM
Is it possible to make the BS2 perform a certain action when a keyboard button is pressed?ˇ I want to control several servos with different keyboard letters.
09-19-2008, 02:54 AM
Hi Hedge, Do you mean to:
Attach a keyboard directly to your BASIC Stamp, or Use the keyboard on your PC while the BASIC Stamp is connected to the PC via a serial or USB port?
If you mean #2, you can do this easily via the Debug Terminal's Transmit Windowpane, using the DEBUGIN command.ˇ
09-19-2008, 02:57 AM
What do you mean by "keyboard"? If you mean the PC's keyboard, then you can use DEBUGIN to receive a character from the debug window of the Stamp Editor (or other similar terminal emulator). Read the chapter on the DEBUGIN statement in the Stamp Basic Manual. You can compare the received character to whatever you want using some IF statements or a SELECT statement and perform whatever action you choose.
If you mean a separate keyboard attached to the Stamp, you can do this too. You can buy a PS/2 keyboard adapter that attaches to a Stamp via a serial connection. You'd use a SERIN statement to receive the typed character.
There are articles in the Nuts and Volts Columns series on attaching a keypad to a Stamp and scanning the keys.
09-19-2008, 03:02 AM
Just FYI, there is an activity in "Robotics with the Boe-Bot" with Continuous Rotation Servo control examples using DEBUGIN.ˇ It's in Chapter 3, page 111.ˇ You can dowload the book free from the Boe-Bot Robot Kit page. (http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/28132/List/1/ProductID/302/Default.aspx?SortField=ProductName%2cProductName)
Also, in "What's a Microcontroller?" there is an activity using DEBUGIN with a Standard Servo, chapter 4, activity 2, on page 119.ˇ You can download itˇfreeˇfrom the BASIC Stamp Activity Kit page (http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/90005/List/1/ProductID/313/Default.aspx?SortField=ProductName%2cProductName).
Editor, Parallax Inc.
09-19-2008, 11:25 AM
Thank You all for your input.ˇ I am using the keyboard already connected to the PC to get the job done.ˇ I will look into all of your suggestions and see what happens.ˇ Im sure that they will work so thanks once again.ˇ God Bless.