This commit is contained in:
Kattni Rembor 2018-05-28 23:05:08 -04:00
parent 0b0fd663a0
commit c0583e35c1
4 changed files with 16 additions and 17 deletions

View file

@ -48,9 +48,9 @@ while True:
# Got a pulse set, now compare. # Got a pulse set, now compare.
if fuzzy_pulse_compare(key1_pulses, pulses): if fuzzy_pulse_compare(key1_pulses, pulses):
print("****** KEY 1 DETECTED! ******") print("****** KEY 1 DETECTED! ******")
keyboard.press(Keycode.SPACE) keyboard.press(Keycode.SPACE)
keyboard.release_all() keyboard.release_all()
if fuzzy_pulse_compare(key2_pulses, pulses): if fuzzy_pulse_compare(key2_pulses, pulses):
print("****** KEY 2 DETECTED! ******") print("****** KEY 2 DETECTED! ******")
keyboard_layout.write("hello!") keyboard_layout.write("hello!")

View file

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

View file

@ -22,14 +22,14 @@ while True:
print((light.value,)) print((light.value,))
# light value drops when a hand passes over # light value drops when a hand passes over
if light.value < 4000: if light.value < 4000:
if motor_a.throttle: if motor_a.throttle:
motor_a.throttle = 0 motor_a.throttle = 0
else: else:
motor_a.throttle = 1 # full speed forward motor_a.throttle = 1 # full speed forward
while (light.value < 5000): while (light.value < 5000):
# wait till hand passes over completely # wait till hand passes over completely
pass pass
time.sleep(0.1) time.sleep(0.1)

View file

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