linting
This commit is contained in:
parent
965d5b5c6a
commit
2d0d86a21a
3 changed files with 40 additions and 41 deletions
|
|
@ -6,7 +6,6 @@ from adafruit_motor import servo, motor
|
|||
from busio import I2C
|
||||
import board
|
||||
import time
|
||||
import gc
|
||||
|
||||
i2c = I2C(board.SCL, board.SDA)
|
||||
ss = Seesaw(i2c)
|
||||
|
|
@ -39,32 +38,32 @@ servos[0].angle = 180
|
|||
|
||||
while True:
|
||||
if switch.value:
|
||||
# Switch is on, activate MUSIC POWER!
|
||||
# Switch is on, activate MUSIC POWER!
|
||||
|
||||
# motor forward slowly
|
||||
motors[0].throttle = 0.2
|
||||
# mote the head forward slowly, over 0.9 seconds
|
||||
for a in range(180, 90, -1):
|
||||
servos[0].angle = a
|
||||
time.sleep(0.01)
|
||||
# motor forward slowly
|
||||
motors[0].throttle = 0.2
|
||||
# mote the head forward slowly, over 0.9 seconds
|
||||
for a in range(180, 90, -1):
|
||||
servos[0].angle = a
|
||||
time.sleep(0.01)
|
||||
|
||||
# motor stop
|
||||
motors[0].throttle = 0
|
||||
time.sleep(1)
|
||||
# motor stop
|
||||
motors[0].throttle = 0
|
||||
time.sleep(1)
|
||||
|
||||
# motor backwards slowly
|
||||
motors[0].throttle = -0.2
|
||||
# move the head back slowly too, over 0.9 seconds
|
||||
for a in range(90, 180):
|
||||
servos[0].angle = a
|
||||
time.sleep(0.01)
|
||||
# calibration! its a *tiny* bit slower going back so give it a few ms
|
||||
time.sleep(0.007)
|
||||
# motor backwards slowly
|
||||
motors[0].throttle = -0.2
|
||||
# move the head back slowly too, over 0.9 seconds
|
||||
for a in range(90, 180):
|
||||
servos[0].angle = a
|
||||
time.sleep(0.01)
|
||||
# calibration! its a *tiny* bit slower going back so give it a few ms
|
||||
time.sleep(0.007)
|
||||
|
||||
# motor stop
|
||||
motors[0].throttle = 0
|
||||
time.sleep(1)
|
||||
# motor stop
|
||||
motors[0].throttle = 0
|
||||
time.sleep(1)
|
||||
else:
|
||||
# switch is 'off' so dont do anything!
|
||||
pass
|
||||
# switch is 'off' so dont do anything!
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -89,34 +89,34 @@ while True: # Main Loop poll switches, do commands
|
|||
#print(touch_vals)
|
||||
|
||||
if touch2.raw_value > 3000:
|
||||
print("Open jaws")
|
||||
pixels.fill((50,50,0))
|
||||
print("Open jaws")
|
||||
pixels.fill((50,50,0))
|
||||
IR_Command(Open) # Button A opens arms
|
||||
|
||||
elif touch3.raw_value > 3000:
|
||||
print("Close jaws")
|
||||
pixels.fill((0,50,0))
|
||||
print("Close jaws")
|
||||
pixels.fill((0,50,0))
|
||||
IR_Command(Close) # Button B closes arms
|
||||
|
||||
elif seesaw.touch_read(0) > CAPTOUCH_THRESH:
|
||||
print("Up")
|
||||
pixels.fill((50,0,50))
|
||||
IR_Command(Up)
|
||||
print("Up")
|
||||
pixels.fill((50,0,50))
|
||||
IR_Command(Up)
|
||||
|
||||
elif seesaw.touch_read(1) > CAPTOUCH_THRESH:
|
||||
print("Down")
|
||||
pixels.fill((50,50,50))
|
||||
IR_Command(Down)
|
||||
print("Down")
|
||||
pixels.fill((50,50,50))
|
||||
IR_Command(Down)
|
||||
|
||||
elif seesaw.touch_read(2) > CAPTOUCH_THRESH:
|
||||
print("Left")
|
||||
pixels.fill((50,0,0))
|
||||
IR_Command(Left)
|
||||
print("Left")
|
||||
pixels.fill((50,0,0))
|
||||
IR_Command(Left)
|
||||
|
||||
elif seesaw.touch_read(3) > CAPTOUCH_THRESH:
|
||||
print("Right")
|
||||
pixels.fill((0,0,50))
|
||||
IR_Command(Right)
|
||||
print("Right")
|
||||
pixels.fill((0,0,50))
|
||||
IR_Command(Right)
|
||||
|
||||
time.sleep(0.1)
|
||||
pixels.fill((0,0,0))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# pylint: disable:wrong-import-position
|
||||
# pylint: disable=wrong-import-position
|
||||
import time
|
||||
import gc
|
||||
import pulseio
|
||||
|
|
|
|||
Loading…
Reference in a new issue