Trying to write a times table tester
Nurbit
Posts: 53
I've finally found time to sit down and get my head around the prop.
I've been working on some code for testing times tables
Here is what I've got so far.....
I'm stuck because the key input system only accepts one key so far so I can't go above 9 and I'd like to go to 12.
Also it stops me entering the correct answer because it only waits for a keypress and not a string of presses.
Does anyone have any life changing information they could share with me?
I've been working on some code for testing times tables
Here is what I've got so far.....
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ text : "tv_text" 'tv output object kb : "keyboard" 'keyboard input object rnd : "SL32_INTEngine_2" 'random numbers VAR byte x[3] byte y[3] byte z[10] PUB Main rnd.random(cnt,1,9) text.start(12) 'start the TV object on pin 12 kb.start(26,27) 'start the keyvoard object on pins 26 and 27 text.str(string(" Nurbit's Times Table Tester",13,13)) 'print to screen (13 adds CR) text.str(string(" Which Table would you like? (1-9)")) 'ask which table kb.getkey if kb.keystate("1") == TRUE text.out($00) x :=1 elseif kb.keystate("2") == TRUE text.out($00) x:=2 elseif kb.keystate("3") ==TRUE text.out($00) x:=3 elseif kb.keystate("4") ==TRUE text.out($00) x:=4 elseif kb.keystate("5") ==TRUE text.out($00) x:=5 elseif kb.keystate("6") ==TRUE text.out($00) x:=6 elseif kb.keystate("7") ==TRUE text.out($00) x:=7 elseif kb.keystate("8") ==TRUE text.out($00) x:=8 elseif kb.keystate("9") ==TRUE text.out($00) x:=9 y:= rnd.random(cnt,1,9) text.out($00) text.str(string("What is ")) text.dec(x) text.str(string(" times ")) text.dec(y) kb.getkey
I'm stuck because the key input system only accepts one key so far so I can't go above 9 and I'd like to go to 12.
Also it stops me entering the correct answer because it only waits for a keypress and not a string of presses.
Does anyone have any life changing information they could share with me?
Comments
Anyhow, it should give you a solid idea of the concept. Good Luck!
Wow, that's really well commented, even I should be able to do something with that
I'll have a play with it