code cleanup
removed adc code, simplified switch use
This commit is contained in:
parent
bd12a37c50
commit
d8f1a3cf05
1 changed files with 24 additions and 29 deletions
|
|
@ -10,7 +10,6 @@ from busio import I2C
|
|||
import board
|
||||
|
||||
i2c = I2C(board.SCL, board.SDA)
|
||||
|
||||
ss = Seesaw(i2c)
|
||||
|
||||
#################### CPX switch
|
||||
|
|
@ -28,9 +27,6 @@ for ss_pin in (17, 16, 15, 14):
|
|||
_servo.angle = 90 # starting angle, middle
|
||||
servos.append(_servo)
|
||||
|
||||
CRCKIT_NUM_ADC = 8
|
||||
CRCKit_adc = [2, 3, 40, 41, 11, 10, 9, 8]
|
||||
|
||||
CAPTOUCH_THRESH = 500 # threshold for touch detection
|
||||
|
||||
cap_state = [False, False, False, False]
|
||||
|
|
@ -41,7 +37,8 @@ curl_finger = [False, False, False, False]
|
|||
finger_name = ['Index', 'Middle', 'Ring', 'Pinky']
|
||||
|
||||
while True:
|
||||
if switch.value: # the CPX switch is on, so do things
|
||||
if not switch.value: # the CPX switch is off, so do nothing
|
||||
continue
|
||||
# Check the cap touch sensors to see if they're being touched
|
||||
for i in range(4):
|
||||
touch_val = ss.touch_read(i)
|
||||
|
|
@ -67,5 +64,3 @@ while True:
|
|||
|
||||
if cap_justtouched[i]:
|
||||
curl_finger[i] = not curl_finger[i]
|
||||
else:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue