Storing value of keyboard
Dan Taylor
Posts: 207
Hi,
I am having a little trouble with the keyboard that comes with the accessories kit. How can I get the output of the keyboard and store it into a variable. And then say,
IF key = 100·THEN
·· ...
IF key = 101 THEN
·· ...
Can someone show me some example code or just explain it to me...
Many Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
I am having a little trouble with the keyboard that comes with the accessories kit. How can I get the output of the keyboard and store it into a variable. And then say,
IF key = 100·THEN
·· ...
IF key = 101 THEN
·· ...
Can someone show me some example code or just explain it to me...
Many Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
Comments
in the folder ...\Propeller-Tool\examples\Library\
there is a file Keyboard_Demo.spin.
You can use this demo as a start.
best regards
Stefan
kb : "keyboard"
term : "tv_terminal"
IF kb.getkey =·97 then
· term.str("a")
But the "a" is never displayed just some random characters. Is it converting it to hexadecimel or something?
·····
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
term.str("a")
with
term.str(string("a"))
I don't know if term.out("a") will work.
John Abshier
Thank you both for your help!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
If you're just displaying text, you could use one of the text drivers like tv_text which does handle the backspace.
Thank you all for your help! I really appreciate it!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor