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.
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,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

@ -22,14 +22,14 @@ 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,10 +1,10 @@
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)
@ -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)