-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_pins.py
59 lines (53 loc) · 1.23 KB
/
test_pins.py
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
import machine
import utime
import sys
pin = input('pin to test:')
testingpin = machine.Pin(int(pin), machine.Pin.OUT)
print('on')
testingpin.on()
utime.sleep(2)
print('off')
testingpin.off()
utime.sleep(2)
print('on')
testingpin.on()
utime.sleep(2)
print('off')
testingpin.off()
utime.sleep(2)
print('on')
testingpin.on()
utime.sleep(2)
print('off')
testingpin.off()
utime.sleep(2)
try:
while True:
continuein = input('quit(q) or continue(c) ')
if (continuein == 'q'):
testingpin.off()
sys.exit()
if (continuein == 'c'):
pin = input('pin to test:')
testingpin = machine.Pin(int(pin), machine.Pin.OUT)
print('on')
testingpin.on()
utime.sleep(2)
print('off')
testingpin.off()
utime.sleep(2)
print('on')
testingpin.on()
utime.sleep(2)
print('off')
testingpin.off()
utime.sleep(2)
print('on')
testingpin.on()
utime.sleep(2)
print('off')
testingpin.off()
utime.sleep(2)
except KeyboardInterrupt:
testingpin.off()
print('exiting')