-
Notifications
You must be signed in to change notification settings - Fork 1
/
button
26 lines (18 loc) · 1.42 KB
/
button
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
Button instructions
import serial
s = serial.Serial('/dev/ttyUSB0', 0)
s.setDTR(level=True)
>>> s.getCD()
False
>>> s.getCD()
True
>>> s.getCD()
True
while True:
p = s.getCD()
if p != pressed:
print p
pressed = p
time.sleep(0.1)
sudoedit /etc/udev/rules.d/50-ttyusb.rules
KERNEL=="ttyUSB[0-9]*",NAME="tts/USB%n",SYMLINK+="%k",GROUP="uucp",MODE="0666"