-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbutton.bas
More file actions
41 lines (28 loc) · 797 Bytes
/
button.bas
File metadata and controls
41 lines (28 loc) · 797 Bytes
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
' PUSH BUTTON
' ===========
'
' This example demonstrates how to connect a push button
' and read the state of this button. If the button is pressed
' a 0 will be returned otherwise 1
'
' ---------------
' PIN10 o----| Push Button |----o GND
' ---------------
'
' The push button is connected to pin 10 and to GND of the IOIO board.
import ioio
PIN10 = ioio.openDigitalInput(10)
print "Wait for connection to IOIO board"
ioio.waitForConnect(10)
print "Connection established"
print
print "Press button connected to IOIO board or q for quit"
isRunning = true
while(isRunning)
key = inkey()
if(key == "q") then isRunning = false
value = PIN10.read()
locate(6,0): print "Button value is: " + value
delay(50)
wend
print "done"