Useing keyboard to ajust varubles??
krazyideas
Posts: 119
I have the propeller Demo board along with the assesorites kit which has a key board.
I want to use the keys on the key board to modifi my program on the fly useing a Dat and an if (this key is pressed) then adjust this varuble this much.
I have the keyboard program that alows me to type on screen but how do I make it affect my varubles
And if ya didn't guess I'm just starting out with this and I'm just learning, so lamans terms would be great.
Thanks so much
crazyideas
I want to use the keys on the key board to modifi my program on the fly useing a Dat and an if (this key is pressed) then adjust this varuble this much.
I have the keyboard program that alows me to type on screen but how do I make it affect my varubles
And if ya didn't guess I'm just starting out with this and I'm just learning, so lamans terms would be great.
Thanks so much
crazyideas
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Paul and crazyideas, let me know if you need Spanish assistant.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.
Alberto.
If you store 12 variables in an array, you could use the letters "a" through "l" for the 12 variables. The next "+" or "-"
would affect the last variable you specified. The default variable would be "a".
I searched all through the manuel that I have and I couldn't really understand what I was doing, or where to put it. Programing the propellor is alot different then the basic stamp.
This is what Mike gave to me. When I read it I thought Oh that won't be too hard, but then it was. I know that it has to be easy but I'm so new at this that it is hard. So I need some more clarification.
Thanks to anyone that sends some helpful info.
Another option when you have several different variables is to use a letter to specify which variable you want to control.
If you store 12 variables in an array, you could use the letters "a" through "l" for the 12 variables. The next "+" or "-"
would affect the last variable you specified. The default variable would be "a".
'·Here·are·the·variables·and·the·pointer·to·the·current·one
VAR·long·variables[noparse][[/noparse]12],·varNumber
'·Here·(in·your·initialization·routine)·you·set·up·the·default
···varNumber·:=·0
'·Here·is·the·stuff·in·the·REPEAT·loop·for·reading·keys
···IF·K·=>·"a"·AND·K·=<·"l"
······varNumber·:=·K·-·"a"
···ELSEIF·K·==·"+"
······variables[noparse][[/noparse]varNumber]++
···ELSEIF·K·==·"-"
······variables[noparse][[/noparse]varNumber]--
···ELSE
······'·Something·else
I hope you weren't thinking Mike's code was an all encompassing example, it doesn't even fetch any keystrokes. So it's not going to work unless you dress it up into functional code.
If you want an example of the absolute simplest keyboard interfacing, look at Keyboard_Demo.spin in your Examples/library. If you want to look at more complex keyboard interfacing look at the logic analyzer application I wrote: http://forums.parallax.com/showthread.php?p=606048
The repeat loop (first line in repeat loop is keyok := false) in Start_DScope, incrementing and decrementing (along with boundry checking) is done when processing the up and down arrows. This is identical to what you are trying to do. The keyboard handling in Set_Preferences is an even more complex example of editable hexidecimal data entry.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 9/30/2008 8:24:31 PM GMT
I will try and work through the manuel again.
You almost have it... where you are having trouble is with the (varNumber := K - "a") statement.
You need a lookdown instruction ... and then just store the key values in an array. page 242 in the Propeller User Manual.
Rich