Merge pull request #200 from kattni/pylint-repo-updates

Final fixes requested on the initial linting
This commit is contained in:
Kattni 2018-05-29 17:55:57 -04:00 committed by GitHub
commit cc01768d1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 378 additions and 595 deletions

View file

@ -52,7 +52,7 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,missing-docstring,invalid-name,bad-whitespace,unused-variable
disable=too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,missing-docstring,invalid-name,bad-whitespace,consider-using-enumerate
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option

View file

@ -157,7 +157,7 @@ theactionlist = [
[5, ACT_NOP, 0, 0, 0]
]
# pylint: disable=global-statement
def nextspectrumcolor():
global spectrum_part, color_idx, curr_color_granularity, color

View file

@ -1,46 +1,46 @@
import time
import board
import pulseio
from digitalio import DigitalInOut, Direction
# PWM (fading) LEDs are connected on D0 (PWM not avail on D1)
pwm_leds = board.D0
pwm = pulseio.PWMOut(pwm_leds, frequency=1000, duty_cycle=0)
# digital LEDs connected on D2
digital_leds = DigitalInOut(board.D2)
digital_leds.direction = Direction.OUTPUT
brightness = 0 # how bright the LED is
fade_amount = 1285 # 2% steping of 2^16
counter = 0 # counter to keep track of cycles
while True:
# And send to LED as PWM level
pwm.duty_cycle = brightness
# change the brightness for next time through the loop:
brightness = brightness + fade_amount
print(brightness)
# reverse the direction of the fading at the ends of the fade:
if brightness <= 0:
fade_amount = -fade_amount
counter += 1
elif brightness >= 65535:
fade_amount = -fade_amount
counter += 1
# wait for 15 ms to see the dimming effect
time.sleep(.015)
# turns on the other LEDs every four times through the fade by
# checking the modulo of the counter.
# the modulo function gives you the remainder of
# the division of two numbers:
if counter % 4 == 0:
digital_leds.value = True
else:
digital_leds.value = False
import time
import board
import pulseio
from digitalio import DigitalInOut, Direction
# PWM (fading) LEDs are connected on D0 (PWM not avail on D1)
pwm_leds = board.D0
pwm = pulseio.PWMOut(pwm_leds, frequency=1000, duty_cycle=0)
# digital LEDs connected on D2
digital_leds = DigitalInOut(board.D2)
digital_leds.direction = Direction.OUTPUT
brightness = 0 # how bright the LED is
fade_amount = 1285 # 2% steping of 2^16
counter = 0 # counter to keep track of cycles
while True:
# And send to LED as PWM level
pwm.duty_cycle = brightness
# change the brightness for next time through the loop:
brightness = brightness + fade_amount
print(brightness)
# reverse the direction of the fading at the ends of the fade:
if brightness <= 0:
fade_amount = -fade_amount
counter += 1
elif brightness >= 65535:
fade_amount = -fade_amount
counter += 1
# wait for 15 ms to see the dimming effect
time.sleep(.015)
# turns on the other LEDs every four times through the fade by
# checking the modulo of the counter.
# the modulo function gives you the remainder of
# the division of two numbers:
if counter % 4 == 0:
digital_leds.value = True
else:
digital_leds.value = False

View file

@ -2,6 +2,7 @@
# When used with the Adafruit NEC remote will act like a keyboard and
# type out keypresses.
import time
import adafruit_irremote
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
@ -9,7 +10,6 @@ from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
import adafruit_dotstar
import pulseio
import board
import time
led = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1)
@ -73,4 +73,3 @@ while True:
led[0] = (100, 0, 0) # flash red
print("Failed to decode: ", e.args)
print("----------------------------")

View file

@ -31,4 +31,3 @@ while True:
print("Failed to decode: ", e.args)
print("----------------------------")

View file

@ -3,7 +3,6 @@
import pulseio
import board
import time
import adafruit_dotstar
import adafruit_irremote

View file

@ -1,3 +1,4 @@
# pylint: disable=multiple-statements,wrong-import-position,wrong-import-order
import gc
from adafruit_hid.keyboard import Keyboard; gc.collect()
from adafruit_hid.keycode import Keycode; gc.collect()
@ -18,7 +19,7 @@ decoder = adafruit_irremote.GenericDecode()
pulsein = pulseio.PulseIn(board.REMOTEIN, maxlen=100, idle_state=True)
# Expected pulse, pasted in from previous recording REPL session:
key1_pulses = [0
key1_pulses = [0]
key2_pulses = [1]
@ -48,9 +49,9 @@ while True:
# Got a pulse set, now compare.
if fuzzy_pulse_compare(key1_pulses, pulses):
print("****** KEY 1 DETECTED! ******")
keyboard.press(Keycode.SPACE)
keyboard.release_all()
keyboard.press(Keycode.SPACE)
keyboard.release_all()
if fuzzy_pulse_compare(key2_pulses, pulses):
print("****** KEY 2 DETECTED! ******")
keyboard_layout.write("hello!")
keyboard_layout.write("hello!")

View file

@ -1,5 +1,6 @@
# Animatronic Hand
# Binary Counting on four fingers up to 15
import time
from digitalio import DigitalInOut, Direction, Pull
import audioio
from adafruit_seesaw.seesaw import Seesaw
@ -7,7 +8,6 @@ from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
from busio import I2C
import board
import time
# Create I2C and seesaw objuect
i2c = I2C(board.SCL, board.SDA)

View file

@ -5,6 +5,7 @@ import time
import board
import pulseio
# pylint: disable=unused-variable,consider-using-enumerate,redefined-outer-name,too-many-locals
piezo = pulseio.PWMOut(board.D0, duty_cycle=0, frequency=440,
variable_frequency=True)
@ -56,6 +57,7 @@ def annoy_doorbell(interval):
time.sleep(interval)
# pylint: disable=too-many-statements
def annoy_ringtone(ringtone, tempo, interval):
# ringtone 1: Nokia
# ringtone 2: Apple iPhone

View file

@ -8,6 +8,8 @@ import ntptime
import ubinascii
import uhashlib
# pylint: disable=broad-except
# https://github.com/pyotp/pyotp example
totp = [("Discord ", 'JBSWY3DPEHPK3PXP'),
("Gmail ", 'abcdefghijklmnopqrstuvwxyz234567'),

View file

@ -4,7 +4,7 @@ import time
import board
import pulseio
from digitalio import DigitalInOut, Direction, Pull
# pylint: disable=eval-used
# Switch to select 'stealth-mode'
switch = DigitalInOut(board.SLIDE_SWITCH)
switch.direction = Direction.INPUT

View file

@ -1,52 +1,54 @@
# Gemma M0 version of TVBgone!
import array
import time
import adafruit_dotstar
import board
import pulseio
from digitalio import DigitalInOut, Direction
pixel = adafruit_dotstar.DotStar(
board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
pixel.fill((0, 0, 0))
# Button to see output debug
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
pwm = pulseio.PWMOut(board.A1, frequency=38000,
duty_cycle=2 ** 15, variable_frequency=True)
pulse = pulseio.PulseOut(pwm)
time.sleep(0.5) # Give a half second before starting
# gooooo!
f = open("/codes.txt", "r")
for line in f:
code = eval(line)
print(code)
pwm.frequency = code['freq']
led.value = True
# If this is a repeating code, extract details
try:
repeat = code['repeat']
delay = code['repeat_delay']
except KeyError: # by default, repeat once only!
repeat = 1
delay = 0
# The table holds the on/off pairs
table = code['table']
pulses = [] # store the pulses here
# Read through each indexed element
for i in code['index']:
pulses += table[i] # and add to the list of pulses
pulses.pop() # remove one final 'low' pulse
for i in range(repeat):
pulse.send(array.array('H', pulses))
time.sleep(delay)
led.value = False
time.sleep(code['delay'])
f.close()
# Gemma M0 version of TVBgone!
import array
import time
import adafruit_dotstar
import board
import pulseio
from digitalio import DigitalInOut, Direction
# pylint: disable=eval-used
pixel = adafruit_dotstar.DotStar(
board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
pixel.fill((0, 0, 0))
# Button to see output debug
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
pwm = pulseio.PWMOut(board.A1, frequency=38000,
duty_cycle=2 ** 15, variable_frequency=True)
pulse = pulseio.PulseOut(pwm)
time.sleep(0.5) # Give a half second before starting
# gooooo!
f = open("/codes.txt", "r")
for line in f:
code = eval(line)
print(code)
pwm.frequency = code['freq']
led.value = True
# If this is a repeating code, extract details
try:
repeat = code['repeat']
delay = code['repeat_delay']
except KeyError: # by default, repeat once only!
repeat = 1
delay = 0
# The table holds the on/off pairs
table = code['table']
pulses = [] # store the pulses here
# Read through each indexed element
for i in code['index']:
pulses += table[i] # and add to the list of pulses
pulses.pop() # remove one final 'low' pulse
for i in range(repeat):
pulse.send(array.array('H', pulses))
time.sleep(delay)
led.value = False
time.sleep(code['delay'])
f.close()

View file

@ -1,4 +1,4 @@
# Stumble Bot, coded in CircuitPython
# Stumble Bot, coded in CircuitPython
# Using an Adafruit Circuit Playground Express, Crickit, and 2 servos
# Dano Wall, Mike Barela for Adafruit Industries, MIT License, May, 2018
#
@ -42,10 +42,10 @@ def servo_front(direction):
index = 90
while index >= 50:
servos[1].angle = index
time.sleep(0.040)
time.sleep(0.040)
index = index - 1
time.sleep(0.002)
time.sleep(0.002)
def servo_back(direction):
if direction > 0:
index = 65
@ -57,15 +57,15 @@ def servo_back(direction):
index = 95
while index >= 65:
servos[0].angle = index
time.sleep(0.040)
time.sleep(0.040)
index = index - 3
time.sleep(0.020)
time.sleep(0.020)
print("Its Stumble Bot Time")
while True:
if button_A.value: # If button A is pressed, start bot
led.value = True # Turn on LED 13 to show we're gone!
if button_A.value: # If button A is pressed, start bot
led.value = True # Turn on LED 13 to show we're gone!
for i in range(5):
print("back 1")
servo_back(1)

View file

@ -1,3 +1,4 @@
import time
from digitalio import DigitalInOut, Direction, Pull
import adafruit_lis3dh
from busio import I2C
@ -6,8 +7,6 @@ from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
import neopixel
import board
import time
import gc
# create accelerometer
i2c1 = I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
@ -46,6 +45,7 @@ try:
fp = None
fp = open(logfile, "a")
print("File system writable!")
# pylint: disable=bare-except
except:
print("Not logging, trapeeze mode!")
@ -82,7 +82,7 @@ while True:
if logpoints > 25:
led.value = True
#print("Writing: "+outstr)
#print("Writing: "+outstr)
fp.write(outstr+"\n")
fp.flush()
led.value = False

View file

@ -1,13 +1,13 @@
import time
from busio import I2C
import analogio
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import motor
import board
import time
light = analogio.AnalogIn(board.LIGHT)
print("Wave on/off to turn")
# Create seesaw object
@ -16,21 +16,18 @@ seesaw = Seesaw(i2c)
# Create one motor on seesaw PWM pins 22 & 23
motor_a = motor.DCMotor(PWMOut(seesaw, 22), PWMOut(seesaw, 23))
motor_a.throttle = 0 # motor is stopped
motor_a.throttle = 0 # motor is stopped
while True:
print((light.value,))
# light value drops when a hand passes over
if light.value < 4000:
if motor_a.throttle:
motor_a.throttle = 0
else:
motor_a.throttle = 1 # full speed forward
if motor_a.throttle:
motor_a.throttle = 0
else:
motor_a.throttle = 1 # full speed forward
while (light.value < 5000):
# wait till hand passes over completely
pass
while light.value < 5000:
# wait till hand passes over completely
pass
time.sleep(0.1)

View file

@ -1,14 +1,14 @@
import time
from busio import I2C
import analogio
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import motor
import board
import time
light = analogio.AnalogIn(board.LIGHT)
print("Theramin-like turning")
# Create seesaw object
@ -30,4 +30,3 @@ while True:
print((light.value,))
motor_a.throttle = map_range(light.value, 500, 8000, 1.0, 0)
time.sleep(0.1)

View file

@ -1,12 +1,12 @@
import time
import array
import math
from busio import I2C
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import motor
import audiobusio
import time
import board
import array
import math
print("Sound sensor motor!")
@ -40,7 +40,7 @@ def normalized_rms(values):
# Our microphone
mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA,
sample_rate=16000, bit_depth = 16)
sample_rate=16000, bit_depth = 16)
samples = array.array('H', [0] * 200)
mic.record(samples, len(samples))
@ -50,4 +50,3 @@ while True:
print(((magnitude),))
motor_a.throttle = map_range(magnitude, 90, 200, 0, 1.0)
time.sleep(0.1)

View file

@ -1,3 +1,4 @@
import time
from digitalio import DigitalInOut, Direction, Pull
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.analoginput import AnalogInput
@ -7,7 +8,6 @@ from busio import I2C
import neopixel
import audioio
import board
import time
# Create seesaw object
i2c = I2C(board.SCL, board.SDA)

View file

@ -1,12 +1,11 @@
# CircuitPython 3.0 CRICKIT demo
import time
from digitalio import DigitalInOut, Direction, Pull
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
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,31 @@ 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

View file

@ -1,3 +1,5 @@
import time
import gc
from digitalio import DigitalInOut, Direction, Pull
from busio import I2C
from adafruit_seesaw.seesaw import Seesaw
@ -6,8 +8,6 @@ import touchio
import audioio
import neopixel
import board
import time
import gc
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=1)
pixels.fill((0,0,0))
@ -58,9 +58,10 @@ def IR_Command(cmd):
if val: # if it's a one, flash the IR LED
seesaw.analog_write(INFRARED_LED_SS, 65535) # on
seesaw.analog_write(INFRARED_LED_SS, 0) # off 2ms later
time.sleep(0.013) # 17 ms total
else:
time.sleep(0.015) # 17 ms total
time.sleep(0.013) # 17 ms total
# pylint: disable=useless-else-on-loop
else:
time.sleep(0.015) # 17 ms total
a = audioio.AudioOut(board.A0)
startfile = "startup.wav"
@ -69,13 +70,13 @@ with open(startfile, "rb") as f:
wav = audioio.WaveFile(f)
a.play(wav)
for _ in range(3):
IR_Command(Calibrate)
time.sleep(0.5)
IR_Command(Calibrate)
time.sleep(0.5)
while a.playing:
IR_Command(Open)
time.sleep(1)
IR_Command(Close)
time.sleep(1)
IR_Command(Open)
time.sleep(1)
IR_Command(Close)
time.sleep(1)
f = open(loopfile, "rb")
wav = audioio.WaveFile(f)
a.play(wav, loop=True)
@ -83,40 +84,41 @@ a.play(wav, loop=True)
while True: # Main Loop poll switches, do commands
led.value = switch.value # easily tell if we're running
if not switch.value:
continue
continue
#touch_vals = (touch2.raw_value, touch3.raw_value, seesaw.touch_read(0), seesaw.touch_read(1), seesaw.touch_read(2), seesaw.touch_read(3))
#touch_vals = (touch2.raw_value, touch3.raw_value, seesaw.touch_read(0), seesaw.touch_read(1),
# seesaw.touch_read(2), seesaw.touch_read(3))
#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))

View file

@ -1,10 +1,10 @@
from digitalio import DigitalInOut, Direction, Pull
import time
from digitalio import DigitalInOut, Direction
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
from busio import I2C
import board
import time
# Create seesaw object
@ -22,7 +22,7 @@ for ss_pin in (17, 16, 15, 14):
_servo = servo.Servo(pwm, min_pulse=600, max_pulse=2500)
_servo.angle = 90 # starting angle, middle
servos.append(_servo)
print("Its TRASH PANDA TIME!")
while True:

View file

@ -1,4 +1,5 @@
# CircuitPython 3.0 CRICKIT demo
import time
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
@ -6,7 +7,6 @@ from busio import I2C
import audioio
import microcontroller
import board
import time
i2c = I2C(board.SCL, board.SDA)
ss = Seesaw(i2c)
@ -40,14 +40,16 @@ ss.digital_write(LED_2, True)
#################### log files
logfile = "/log.csv"
# pylint: disable=pointless-statement
# check that we could append if wanted to
try:
fp = open(logfile, "a")
fp.close
# pylint: disable=bare-except
except:
print("File system not writable, halting")
while True:
pass
pass
#################### Audio files
wavfile = "yanny.wav"
@ -78,21 +80,21 @@ ss.digital_write(LED_1, False)
ss.digital_write(LED_2, False)
selection = None
# wait until
# wait until
while not selection:
if not ss.digital_read(BUTTON_1):
selection = "Yanny"
ss.digital_write(LED_1, True)
myservo.angle = LOOKLEFT
break
selection = "Yanny"
ss.digital_write(LED_1, True)
myservo.angle = LOOKLEFT
break
if not ss.digital_read(BUTTON_2):
selection = "Laurel"
ss.digital_write(LED_2, True)
myservo.angle = LOOKRIGHT
break
selection = "Laurel"
ss.digital_write(LED_2, True)
myservo.angle = LOOKRIGHT
break
# if we havent selected, wait until they do!
if a.playing and time.monotonic() - t > 15.5:
a.pause()
a.pause()
# now we have a selection!
with open(logfile, "a") as fp:

View file

@ -1,5 +1,9 @@
# pylint: disable=wrong-import-position
import time
import gc
import pulseio
from busio import I2C
import board
gc.collect()
import adafruit_irremote
gc.collect()
@ -13,9 +17,6 @@ import neopixel
gc.collect()
import audioio
gc.collect()
from busio import I2C
import board
import time
print("Blimp!")
@ -39,12 +40,13 @@ pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
# audio file
a = audioio.AudioOut(board.A0)
def play_audio(wavfile):
f = open(wavfile, "rb")
wav = audioio.WaveFile(f)
a.play(wav)
while a.playing:
pass
pass
f.close()
gc.collect()
@ -54,34 +56,35 @@ t = time.monotonic()
while True:
command = None # assume no remote commands came in
if len(pulsein) > 25: # check in any IR data came in
pulses = decoder.read_pulses(pulsein)
try:
code = decoder.decode_bits(pulses, debug=False)
if code in (REMOTE_FORWARD, REMOTE_BACKWARD, REMOTE_PAUSE):
# we only listen to a few different codes
command = code
else:
continue
# on any failure, lets just restart
except:
continue
pulses = decoder.read_pulses(pulsein)
try:
code = decoder.decode_bits(pulses, debug=False)
if code in (REMOTE_FORWARD, REMOTE_BACKWARD, REMOTE_PAUSE):
# we only listen to a few different codes
command = code
else:
continue
# on any failure, lets just restart
# pylint: disable=bare-except
except:
continue
if command:
if code == REMOTE_FORWARD:
play_audio("fan_forward.wav")
motor_a.throttle = 1 # full speed forward
pixels.fill((255,0,0))
elif code == REMOTE_BACKWARD:
play_audio("fan_backward.wav")
motor_a.throttle = -1 # full speed backward
pixels.fill((0,0,255))
elif code == REMOTE_PAUSE:
motor_a.throttle = 0 # stop motor
play_audio("fan_stopped.wav")
pixels.fill((0,0,0))
time.sleep(0.5)
if code == REMOTE_FORWARD:
play_audio("fan_forward.wav")
motor_a.throttle = 1 # full speed forward
pixels.fill((255,0,0))
elif code == REMOTE_BACKWARD:
play_audio("fan_backward.wav")
motor_a.throttle = -1 # full speed backward
pixels.fill((0,0,255))
elif code == REMOTE_PAUSE:
motor_a.throttle = 0 # stop motor
play_audio("fan_stopped.wav")
pixels.fill((0,0,0))
time.sleep(0.5)
# play yayayay every 3 seconds
if (time.monotonic() - t > 3) and motor_a.throttle != 0:
t = time.monotonic()
play_audio("yayyayyay.wav")
t = time.monotonic()
play_audio("yayyayyay.wav")

View file

@ -122,7 +122,7 @@ beat_phase = beat_period / 5.0 # Phase controls how long in-between
# transforming a value in one range to a value in another (like Arduino's map
# function).
# pylint: disable=redefined-outer-name
def lerp(x, x0, x1, y0, y1):
return y0 + (x - x0) * ((y1 - y0) / (x1 - x0))

View file

@ -131,6 +131,7 @@ beat_phase = beat_period / 5.0 # Phase controls how long in-between
# the two parts of the heart beat
# (the 'ba-boom' of the beat).
# pylint: disable=redefined-outer-name
# Define a gamma correction lookup table to make colors more accurate.
# See this guide for more background on gamma correction:
# https://learn.adafruit.com/led-tricks-gamma-correction/

View file

@ -55,7 +55,8 @@ class DirectoryNode(object):
self.files = None
return self
def __is_dir(self, path):
@staticmethod
def __is_dir(path):
"""Determine whether a path identifies a machine code bin file.
:param string path: path of the file to check
"""
@ -67,7 +68,8 @@ class DirectoryNode(object):
except OSError:
return False
def __sanitize(self, name):
@staticmethod
def __sanitize(name):
"""Nondestructively strip off a trailing slash, if any, and return the result.
:param string name: the filename
"""
@ -75,6 +77,7 @@ class DirectoryNode(object):
return name[:-1]
return name
# pylint: disable=protected-access
def __path(self):
"""Return the result of recursively follow the parent links, building a full
path to this directory."""
@ -133,7 +136,8 @@ class DirectoryNode(object):
self.display.show()
self.old_selected_offset = self.selected_offset
def __is_directory_name(self, filename):
@staticmethod
def __is_directory_name(filename):
"""Is a filename the name of a directory.
:param string filename: the name of the file
"""

View file

@ -39,6 +39,7 @@ from debouncer import Debouncer
from directory_node import DirectoryNode
from emulator import Emulator
# pylint: disable=global-statement
# --------------------------------------------------------------------------------
# Initialize Rotary encoder
@ -120,6 +121,7 @@ def display_emulating_screen():
oled.show()
# pylint: disable=global-statement
def emulate():
global current_mode
data = load_file(current_dir.selected_filepath)
@ -129,6 +131,7 @@ def emulate():
display_emulating_screen()
# pylint: disable=global-statement
def program():
global current_mode
emulator.enter_program_mode()

View file

@ -58,6 +58,7 @@ pause = 0.25
# The functions that follow are the various payloads to deliver
# pylint: disable=too-many-statements
def launch_terminal():
if operating_system is 0:
led.value = False

View file

@ -100,6 +100,7 @@ def h2rgb(colour_hue):
return ret * 17
# pylint: disable=global-statement
def wave_setup():
global wave

View file

@ -1,39 +0,0 @@
Welcome to CircuitPython!
#############################
Visit the Gemma M0 product page here for more info:
https://adafruit.com/product/3501
#############################
The Gemma has a very tiny disk drive so we have disabled Mac OS X indexing
which could take up that valuable space.
So *please* do not remove the empty .fseventsd/no_log, .metadata_never_index
or .Trashes files!
#############################
The pre-loaded demo shows off what your Gemma M0 can do with CircuitPython:
* The built in DotStar LED can show any color, it will swirl through the rainbow
* Pin A0 is a true analog output, you will see the voltage slowly rise
* Pin A1 is an analog input, the REPL will display the voltage on this pin
(0-3.3V is the max range)
* Pin A2 is a capacitive input, when touched, it will turn on the red LED.
If you update main.py to uncomment the relevant lines, it will act as a
mini keyboard and emulate an 'a' key-press whenever A2 is touched.
For more details on how to use CircuitPython, visit
https://adafruit.com/product/3501 and check out all the tutorials we have!
#############################
CircuitPython Quick Start:
Changing the code is as easy as editing main.py in your favorite text editor.
We recommend Atom, Notepad++, or Visual Studio Code. After the file is saved,
CircuitPython will automatically reload the latest code. Try enabling the
capacitive keyboard (HINT: look for the "# optional! uncomment below..." text)
Connecting to the serial port will give you access to better error messages and
interactive CircuitPython (known as the REPL). On Windows we recommend Tera Term
or PuTTY. On Mac OSX and Linux, 'screen' can be used from a terminal.

View file

@ -1,115 +0,0 @@
;************************************************************
; Windows USB CDC ACM Setup File
; Copyright (c) 2000 Microsoft Corporation
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MFGNAME%
LayoutFile=layout.inf
CatalogFile=%MFGFILENAME%.cat
DriverVer=11/15/2007,5.1.2600.0
[Manufacturer]
%MFGNAME%=DeviceList, NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista-32bit Sections
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Vista-64bit Sections
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Vendor and Product ID Definitions
;------------------------------------------------------------------------------
; When developing your USB device, the VID and PID used in the PC side
; application program and the firmware on the microcontroller must match.
; Modify the below line to use your VID and PID. Use the format as shown below.
; Note: One INF file can be used for multiple devices with different VID and PIDs.
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D&MI_00
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_001C&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801C&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_239A&PID_801D&MI_00
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
;Modify these strings to customize your device
;------------------------------------------------------------------------------
[Strings]
MFGFILENAME="CDC_vista"
DRIVERFILENAME ="usbser"
MFGNAME="Adafruit Industries LLC"
INSTDISK="Gemma M0 Driver Installer"
DESCRIPTION="Adafruit Gemma M0"
SERVICE="USB RS-232 Emulation Driver"

View file

@ -1,2 +0,0 @@
This driver is required on Windows 7 only, to create the Serial Port.
Do not install on Windows 10!

View file

@ -1,78 +0,0 @@
# Gemma IO demo
# Welcome to CircuitPython 2.0.0 :)
import adafruit_dotstar as dotstar
import board
from adafruit_hid.keyboard import Keyboard
from analogio import AnalogIn, AnalogOut
from digitalio import DigitalInOut, Direction
from touchio import TouchIn
# One pixel connected internally!
dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
# Built in red LED
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
# Analog output on A0
aout = AnalogOut(board.A0)
# Analog input on A1
analog1in = AnalogIn(board.A1)
# Capacitive touch on A2
touch2 = TouchIn(board.A2)
# Used if we do HID output, see below
kbd = Keyboard()
# Helpers
# Helper to convert analog input to voltage
def getVoltage(pin):
return (pin.value * 3.3) / 65536
# Helper to give us a nice color swirl
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if pos < 0:
return [0, 0, 0]
if pos > 255:
return [0, 0, 0]
if pos < 85:
return [int(pos * 3), int(255 - (pos * 3)), 0]
elif pos < 170:
pos -= 85
return [int(255 - pos * 3), 0, int(pos * 3)]
else:
pos -= 170
return [0, int(pos * 3), int(255 - pos * 3)]
# Main Loop
i = 0
while True:
# spin internal LED around!
dot[0] = wheel(i)
dot.show()
# set analog output to 0-3.3V (0-65535 in increments)
aout.value = i * 256
# Read analog voltage on A1
print("A1: %0.2f" % getVoltage(analog1in))
# use A2 as capacitive touch to turn on internal LED
if touch2.value:
print("A2 touched!")
# optional! uncomment below & save to have it sent a keypress
# kbd.press(Keycode.A)
# kbd.release_all()
led.value = touch2.value
i = (i + 1) % 256 # run from 0 to 255

Binary file not shown.

View file

@ -1,32 +1,32 @@
import time
import analogio
import board
import pulseio
sampleWindow = 0.033 # Sample window width (0.033 sec = 33 mS = ~30 Hz)
ledPin = board.D0 # Pin where LEDs are connected (PWM not avail on D1)
micPin = board.A1 # Microphone 'OUT' is connected here
mic = analogio.AnalogIn(micPin)
pwm = pulseio.PWMOut(ledPin, frequency=1000, duty_cycle=0)
while True:
# Listen to mic for short interval, recording min & max signal
signalMin = 65535
signalMax = 0
startTime = time.monotonic()
while (time.monotonic() - startTime) < sampleWindow:
signal = mic.value
if signal < signalMin:
signalMin = signal
if signal > signalMax:
signalMax = signal
peakToPeak = signalMax - signalMin # Audio amplitude
n = (peakToPeak - 250) * 4 # Remove low-level noise, boost
if n > 65535:
n = 65535 # Limit to valid PWM range
elif n < 0:
n = 0
pwm.duty_cycle = n # And send to LED as PWM level
import time
import analogio
import board
import pulseio
sampleWindow = 0.033 # Sample window width (0.033 sec = 33 mS = ~30 Hz)
ledPin = board.D0 # Pin where LEDs are connected (PWM not avail on D1)
micPin = board.A1 # Microphone 'OUT' is connected here
mic = analogio.AnalogIn(micPin)
pwm = pulseio.PWMOut(ledPin, frequency=1000, duty_cycle=0)
while True:
# Listen to mic for short interval, recording min & max signal
signalMin = 65535
signalMax = 0
startTime = time.monotonic()
while (time.monotonic() - startTime) < sampleWindow:
signal = mic.value
if signal < signalMin:
signalMin = signal
if signal > signalMax:
signalMax = signal
peakToPeak = signalMax - signalMin # Audio amplitude
n = (peakToPeak - 250) * 4 # Remove low-level noise, boost
if n > 65535:
n = 65535 # Limit to valid PWM range
elif n < 0:
n = 0
pwm.duty_cycle = n # And send to LED as PWM level

View file

@ -1,32 +1,32 @@
import time
import board
import neopixel
numpix = 5 # Number of NeoPixels
pixpin = board.D1 # Pin where NeoPixels are connected
hue = 0 # Starting color
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.4)
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return [0, 0, 0]
elif pos < 85:
return [int(pos * 3), int(255 - (pos * 3)), 0]
elif pos < 170:
pos -= 85
return [int(255 - pos * 3), 0, int(pos * 3)]
else:
pos -= 170
return [0, int(pos * 3), int(255 - pos * 3)]
while True: # Loop forever...
for i in range(numpix):
strip[i] = wheel((hue + i * 8) & 255)
strip.write()
time.sleep(0.02) # 20 ms = ~50 fps
hue = (hue + 1) & 255 # Increment hue and 'wrap around' at 255
import time
import board
import neopixel
numpix = 5 # Number of NeoPixels
pixpin = board.D1 # Pin where NeoPixels are connected
hue = 0 # Starting color
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.4)
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return [0, 0, 0]
elif pos < 85:
return [int(pos * 3), int(255 - (pos * 3)), 0]
elif pos < 170:
pos -= 85
return [int(255 - pos * 3), 0, int(pos * 3)]
else:
pos -= 170
return [0, int(pos * 3), int(255 - pos * 3)]
while True: # Loop forever...
for i in range(numpix):
strip[i] = wheel((hue + i * 8) & 255)
strip.write()
time.sleep(0.02) # 20 ms = ~50 fps
hue = (hue + 1) & 255 # Increment hue and 'wrap around' at 255

View file

@ -1,31 +1,31 @@
import time
import board
import digitalio
import neopixel
numpix = 8 # Number of NeoPixels
ledpin = board.D1 # Digital pin # where NeoPixels are connected
sensorpin = board.D2 # Digital pin # where light sensor is connected
strip = neopixel.NeoPixel(ledpin, numpix, brightness=1.0)
# Enable internal pullup resistor on sensor pin
pin = digitalio.DigitalInOut(sensorpin)
pin.direction = digitalio.Direction.INPUT
pin.pull = digitalio.Pull.UP
while True: # Loop forever...
# LDR is being used as a digital (binary) sensor. It must be
# completely dark to turn it off, a finger may not be opaque enough!
if pin.value:
color = (0, 0, 0) # Off
else:
color = (255, 0, 255) # Purple
for i in range(numpix): # For each pixel...
strip[i] = color # Set to 'color'
strip.write() # Push data to pixels
time.sleep(0.05) # Pause 50 ms
time.sleep(0.002) # Pause 2 ms
import time
import board
import digitalio
import neopixel
numpix = 8 # Number of NeoPixels
ledpin = board.D1 # Digital pin # where NeoPixels are connected
sensorpin = board.D2 # Digital pin # where light sensor is connected
strip = neopixel.NeoPixel(ledpin, numpix, brightness=1.0)
# Enable internal pullup resistor on sensor pin
pin = digitalio.DigitalInOut(sensorpin)
pin.direction = digitalio.Direction.INPUT
pin.pull = digitalio.Pull.UP
while True: # Loop forever...
# LDR is being used as a digital (binary) sensor. It must be
# completely dark to turn it off, a finger may not be opaque enough!
if pin.value:
color = (0, 0, 0) # Off
else:
color = (255, 0, 255) # Purple
for i in range(numpix): # For each pixel...
strip[i] = color # Set to 'color'
strip.write() # Push data to pixels
time.sleep(0.05) # Pause 50 ms
time.sleep(0.002) # Pause 2 ms

View file

@ -1,14 +1,14 @@
# Nintendo R.O.B. control with Accelerometer, code in CircuitPython
# Nintendo R.O.B. control with Accelerometer, code in CircuitPython
# Using an Adafruit Circuit Playground Express board with an IR LED
# Mike Barela for Adafruit Industries, MIT License, May, 2018
# Acknowledgement to info at http://atariage.com/forums/topic/177286
# -any-interest-in-nes-rob-homebrews/ and Limor Ladyada Fried
import time
import gc
from digitalio import DigitalInOut, Direction
from adafruit_circuitplayground.express import cpx
import board
import time
import gc
# Commands, each 8 bit command is preceded by the 5 bit Init sequence
Init = [0, 0, 0, 1, 0] # This must precede any command
@ -37,11 +37,11 @@ def IR_Command(cmd):
for val in Init+cmd: # For each value in initial+command
if val: # if it's a one, flash the IR LED
IRled.value = True # Turn IR LED turn on for 1.5 ms
time.sleep(0.0015) # 1.5 ms on
time.sleep(0.0015) # 1.5 ms on
IRled.value = False # Turn IR LED off for 15 ms
time.sleep(0.0150) # 15 ms
else:
time.sleep(0.0167) # 1 cycle turn off
time.sleep(0.0167) # 1 cycle turn off
while True: # Main Loop poll switches, do commands
x, y, z = cpx.acceleration # Read accelerometer

View file

@ -6,5 +6,5 @@ import board
light = analogio.AnalogIn(board.LIGHT)
while True:
print(light.value)
print((light.value,))
time.sleep(0.1)

View file

@ -7,6 +7,6 @@ thermistor = adafruit_thermistor.Thermistor(
board.TEMPERATURE, 10000, 10000, 25, 3950)
while True:
print(thermistor.temperature)
print((thermistor.temperature,))
# print(((thermistor.temperature * 9 / 5 + 32),)) # Fahrenheit
time.sleep(0.25)

View file

@ -41,6 +41,7 @@ def fade_pixels(fade_color):
fade_pixels(GREEN)
# pylint: disable=too-many-locals
def play_song(song_number):
# 1: Jingle bells
# 2: Let It Snow
@ -53,6 +54,7 @@ def play_song(song_number):
dotted_quarter_note = quarter_note * 1.5
eighth_note = whole_note / 8
# pylint: disable=unused-variable
# set up note values
A3 = 220
Bb3 = 233
@ -85,7 +87,7 @@ def play_song(song_number):
[D4, eighth_note],
[E4, whole_note],
]
# pylint: disable=consider-using-enumerate
for n in range(len(jingle_bells_song)):
cpx.start_tone(jingle_bells_song[n][0])
time.sleep(jingle_bells_song[n][1])

View file

@ -1,9 +1,9 @@
import time
from busio import I2C
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import motor
import board
import time
# Create seesaw object
i2c = I2C(board.SCL, board.SDA)
@ -24,5 +24,5 @@ while True:
my_drive.duty_cycle = 16384 # dim
time.sleep(0.1)
# and repeat!

View file

@ -1,12 +1,13 @@
# Code for the Trash Panda tutorial with Adafruit Crickit and Circuit Playground Express 5/2018 Dano Wall
# Code for the Trash Panda tutorial with Adafruit Crickit and Circuit Playground Express
# 5/2018 Dano Wall
from digitalio import DigitalInOut, Direction, Pull
import time
from digitalio import DigitalInOut, Direction
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo
from busio import I2C
import board
import time
# Create seesaw object
i2c = I2C(board.SCL, board.SDA)
@ -23,7 +24,7 @@ for ss_pin in (17, 16, 15, 14):
_servo = servo.Servo(pwm, min_pulse=600, max_pulse=2500)
_servo.angle = 90 # starting angle, middle
servos.append(_servo)
print("Its TRASH PANDA TIME!")
while True: