-
Notifications
You must be signed in to change notification settings - Fork 0
/
trackBallEx.spin
65 lines (53 loc) · 862 Bytes
/
trackBallEx.spin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
CON
Btn=15
up=14
down=13
left=11
right=12
_clkmode=xtal1+pll16x
_xinfreq=5_000_000
var
long pressedStatus
long upStatus
long downStatus
long rightStatus
long leftStatus
PUB Run
waitcnt(clkfreq/10+cnt)
if ina[up]==0
upStatus:=true
else
upStatus:=false
if ina[down]==0
downStatus:=true
else
downStatus:=false
if ina[left]==0
leftStatus:=true
else
leftStatus:=false
if ina[right]==0
rightStatus:=true
else
rightStatus:=false
if ina[Btn]==0
pressedStatus:=true
else
pressedStatus:=false
pub isPressed
return pressedStatus
pub isRight
return rightStatus
pub isLeft
return leftStatus
pub isDown
return downStatus
pub isUp
return upStatus
pub WaitForBtnPress
repeat
Run
if isPressed ==true
repeat until isPressed==false
Run
return