From f4de200abb98d3bf07cd5ce456a91fb70bd3253c Mon Sep 17 00:00:00 2001 From: foamyguy Date: Thu, 26 Aug 2021 18:23:38 -0500 Subject: [PATCH] use cp7 API for PulseOut init --- Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure.py | 6 ++---- Circuit_Playground_Express_IR_Zombie_Game/code.py | 6 ++---- Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit.py | 6 ++---- IrRobotControl/glove.py | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure.py b/Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure.py index e414c9c25..d689760f1 100644 --- a/Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure.py +++ b/Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure.py @@ -1,6 +1,5 @@ import time import board -import pwmio import pulseio import adafruit_irremote import neopixel @@ -12,9 +11,8 @@ TRANSMIT_DELAY = 15 # change this as desired to affect game dynamics, or just l # Create NeoPixel object to indicate status pixels = neopixel.NeoPixel(board.NEOPIXEL, 10) -# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz -pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) -pulseout = pulseio.PulseOut(pwm) +# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz +pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) # Create an encoder that will take numbers and turn them into IR pulses encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], diff --git a/Circuit_Playground_Express_IR_Zombie_Game/code.py b/Circuit_Playground_Express_IR_Zombie_Game/code.py index b80989a6d..3322d3b26 100755 --- a/Circuit_Playground_Express_IR_Zombie_Game/code.py +++ b/Circuit_Playground_Express_IR_Zombie_Game/code.py @@ -1,6 +1,5 @@ import time import pulseio -import pwmio import board import adafruit_irremote import digitalio @@ -22,9 +21,8 @@ pulsein = pulseio.PulseIn(board.IR_RX, maxlen=120, idle_state=True) # Create a decoder that will take pulses and turn them into numbers decoder = adafruit_irremote.GenericDecode() -# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz -pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) -pulseout = pulseio.PulseOut(pwm) +# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz +pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) # Create an encoder that will take numbers and turn them into NEC IR pulses encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550], zero=[550, 1700], trail=0) diff --git a/Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit.py b/Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit.py index db9a5b667..524c4d0e4 100644 --- a/Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit.py +++ b/Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit.py @@ -2,12 +2,10 @@ import time from adafruit_circuitplayground.express import cpx import adafruit_irremote import pulseio -import pwmio import board -# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz -pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) -pulseout = pulseio.PulseOut(pwm) +# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz +pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) # Create an encoder that will take numbers and turn them into NEC IR pulses encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550], zero=[550, 1700], trail=0) diff --git a/IrRobotControl/glove.py b/IrRobotControl/glove.py index f81b783f5..866a60dea 100644 --- a/IrRobotControl/glove.py +++ b/IrRobotControl/glove.py @@ -2,7 +2,6 @@ import time import busio import board import pulseio -import pwmio import adafruit_irremote import adafruit_lis3dh @@ -26,9 +25,8 @@ TRANSMIT_DELAY = 0.1 i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA) sensor = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19) -# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz -pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) -pulseout = pulseio.PulseOut(pwm) +# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz +pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15) # Create an encoder that will take numbers and turn them into IR pulses encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500],