Merge pull request #1811 from FoamyGuy/cp7_PulseOut

use cp7 API for PulseOut init
This commit is contained in:
Anne Barela 2021-10-01 18:56:48 -04:00 committed by GitHub
commit ee4ebab91f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 16 deletions

View file

@ -1,6 +1,5 @@
import time import time
import board import board
import pwmio
import pulseio import pulseio
import adafruit_irremote import adafruit_irremote
import neopixel 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 # Create NeoPixel object to indicate status
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10) pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz # Create a 'pulseio' 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(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
pulseout = pulseio.PulseOut(pwm)
# Create an encoder that will take numbers and turn them into IR pulses # Create an encoder that will take numbers and turn them into IR pulses
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500],

View file

@ -1,6 +1,5 @@
import time import time
import pulseio import pulseio
import pwmio
import board import board
import adafruit_irremote import adafruit_irremote
import digitalio 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 # Create a decoder that will take pulses and turn them into numbers
decoder = adafruit_irremote.GenericDecode() decoder = adafruit_irremote.GenericDecode()
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz # Create a 'pulseio' 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(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
pulseout = pulseio.PulseOut(pwm)
# Create an encoder that will take numbers and turn them into NEC IR pulses # Create an encoder that will take numbers and turn them into NEC IR pulses
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550], encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550],
zero=[550, 1700], trail=0) zero=[550, 1700], trail=0)

View file

@ -2,12 +2,10 @@ import time
from adafruit_circuitplayground.express import cpx from adafruit_circuitplayground.express import cpx
import adafruit_irremote import adafruit_irremote
import pulseio import pulseio
import pwmio
import board import board
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz # Create a 'pulseio' 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(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
pulseout = pulseio.PulseOut(pwm)
# Create an encoder that will take numbers and turn them into NEC IR pulses # Create an encoder that will take numbers and turn them into NEC IR pulses
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550], encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550],
zero=[550, 1700], trail=0) zero=[550, 1700], trail=0)

View file

@ -2,7 +2,6 @@ import time
import busio import busio
import board import board
import pulseio import pulseio
import pwmio
import adafruit_irremote import adafruit_irremote
import adafruit_lis3dh import adafruit_lis3dh
@ -26,9 +25,8 @@ TRANSMIT_DELAY = 0.1
i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA) i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
sensor = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19) sensor = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19)
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz # Create a 'pulseio' 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(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
pulseout = pulseio.PulseOut(pwm)
# Create an encoder that will take numbers and turn them into IR pulses # Create an encoder that will take numbers and turn them into IR pulses
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500],