This commit is contained in:
Kattni Rembor 2018-05-29 14:52:24 -04:00
parent e0e084e6b0
commit d11026dc22
4 changed files with 13 additions and 11 deletions

View file

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

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

View file

@ -1,9 +1,9 @@
import time
from busio import I2C from busio import I2C
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
# Create seesaw object # Create seesaw object
i2c = I2C(board.SCL, board.SDA) i2c = I2C(board.SCL, board.SDA)
@ -24,5 +24,5 @@ while True:
my_drive.duty_cycle = 16384 # dim my_drive.duty_cycle = 16384 # dim
time.sleep(0.1) time.sleep(0.1)
# and repeat! # 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.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import servo from adafruit_motor import servo
from busio import I2C from busio import I2C
import board import board
import time
# Create seesaw object # Create seesaw object
i2c = I2C(board.SCL, board.SDA) 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 = servo.Servo(pwm, min_pulse=600, max_pulse=2500)
_servo.angle = 90 # starting angle, middle _servo.angle = 90 # starting angle, middle
servos.append(_servo) servos.append(_servo)
print("Its TRASH PANDA TIME!") print("Its TRASH PANDA TIME!")
while True: while True: