multiple key-stroke inputs
lod7832
Posts: 6
I am trying to control a robot and I am creating a control box for this to do so and the robot has many tasks that need to be controlled. These tasks require multiply inputs form the key board.· I am trying to figure out ways that will allow me to read in constant values into the basic stamp and be able to know the different values.· For example if I were trying to control motion with the number key pad and trying·to move the robot left.····I would need to hit·an 8 to move forward and then I would need to hit a 4 at the same time to move left. How can I hold down an 8 and 4 to move left and keep this motion as long as I am pushing them down? I am new to the basic stamp and do not know a lot of its abilities.· Please I have been·working on this for quite some time and I do not know what else to do. Thank you for any suggestions ·
Comments
Info on and gates:
http://www.play-hookey.com/digital/basic_gates.html
Or are you are looking at sending the directional commands serially from a P.C - to the device
Quattro
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
if it is a case that this is a purpose built switch unit then Look at the IF, AND options
' Looking at a case where 2 buttons are pressed together
e.g.
IF IN1 = 1 AND IN2 = 1 Then ....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
i am trying to read the values in from the serial port one big problem that i am having is i dont konw what type of signal the rs232 is sending and how is it different when it is sending 2 pressed keys.
does it send a 4 bit signal 8 16? and then how do i take that signal and make it to different variables like in1 and in2 how will keep reading the two values if i am holding them down?
thank you again
If you are sending the information serially you will be 'acting on' what is 'received' therefore the 'IN' example I gave is not relevant. Based on what you have said Read up on the Serin /Serout Commands for serial communications - test communication with Hyperterminal or similar prog.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Post Edited (QuattroRS4) : 2/22/2007 3:05:33 AM GMT
mynumber VAR Byte(2)
main:
DEBUGIN STR mynumber\2\13
DEBUG "ASCII value 1 ", DEC ? mynumber(0),"ASCII value 2 ",DEC ? mynumber(1)
mynumber(0)=mynumber(0)-48
mynumber(1)=mynumber(1)-48
DEBUG "Decimal value 1 ", DEC ? mynumber(0),"Decimal value 2 ",DEC ? mynumber(1)
mynumber(0)=0
mynumber(1)=0
GOTO main
each element of the array will hold the ASCII value of 1 of your inputs, to convert the ASCII value to·its decimal character value subtract 48. Be aware that the input is stored as two seperate values so entering, for example, 32 is stored as the number 3 in element 0 and the number 2 in element 1. Look at the DEBUGIN and the SERIN help files and formats.
Jeff T.