use cp7 API for PulseOut init

This commit is contained in:
foamyguy 2021-08-26 18:23:38 -05:00
parent c81da171ce
commit f4de200abb
4 changed files with 8 additions and 16 deletions

View file

@ -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],

View file

@ -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)

View file

@ -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)

View file

@ -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],