Skip to content

Commit ee4ebab

Browse files
authored
Merge pull request #1811 from FoamyGuy/cp7_PulseOut
use cp7 API for PulseOut init
2 parents 6e7a846 + 26eb5e3 commit ee4ebab

4 files changed

Lines changed: 8 additions & 16 deletions

File tree

  • Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure
  • Circuit_Playground_Express_IR_Zombie_Game
  • Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit
  • IrRobotControl/glove

Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Treasure/code.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import time
22
import board
3-
import pwmio
43
import pulseio
54
import adafruit_irremote
65
import neopixel
@@ -12,9 +11,8 @@
1211
# Create NeoPixel object to indicate status
1312
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
1413

15-
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz
16-
pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
17-
pulseout = pulseio.PulseOut(pwm)
14+
# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz
15+
pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
1816

1917
# Create an encoder that will take numbers and turn them into IR pulses
2018
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500],

Circuit_Playground_Express_IR_Zombie_Game/code.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import time
22
import pulseio
3-
import pwmio
43
import board
54
import adafruit_irremote
65
import digitalio
@@ -22,9 +21,8 @@
2221
# Create a decoder that will take pulses and turn them into numbers
2322
decoder = adafruit_irremote.GenericDecode()
2423

25-
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz
26-
pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
27-
pulseout = pulseio.PulseOut(pwm)
24+
# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz
25+
pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
2826
# Create an encoder that will take numbers and turn them into NEC IR pulses
2927
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550],
3028
zero=[550, 1700], trail=0)

Circuit_Playground_Express_and_IR/CPX_IR_CPX_transmit/code.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
from adafruit_circuitplayground.express import cpx
33
import adafruit_irremote
44
import pulseio
5-
import pwmio
65
import board
76

8-
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz
9-
pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
10-
pulseout = pulseio.PulseOut(pwm)
7+
# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz
8+
pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
119
# Create an encoder that will take numbers and turn them into NEC IR pulses
1210
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500], one=[550, 550],
1311
zero=[550, 1700], trail=0)

IrRobotControl/glove/code.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import busio
33
import board
44
import pulseio
5-
import pwmio
65
import adafruit_irremote
76
import adafruit_lis3dh
87

@@ -26,9 +25,8 @@
2625
i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
2726
sensor = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19)
2827

29-
# Create a 'pwmio' output, to send infrared signals on the IR transmitter @ 38KHz
30-
pwm = pwmio.PWMOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
31-
pulseout = pulseio.PulseOut(pwm)
28+
# Create a 'pulseio' output, to send infrared signals on the IR transmitter @ 38KHz
29+
pulseout = pulseio.PulseOut(board.IR_TX, frequency=38000, duty_cycle=2 ** 15)
3230

3331
# Create an encoder that will take numbers and turn them into IR pulses
3432
encoder = adafruit_irremote.GenericTransmit(header=[9500, 4500],

0 commit comments

Comments
 (0)