Skip to content

Commit 9b9b26a

Browse files
committed
Switch to busio and pulseio.
1 parent 4c0f244 commit 9b9b26a

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

examples/piano.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55
import time
66

77
import board
8-
import nativeio
9-
10-
# Uncomment _one_ of the following lines depending on how your board supports I2C.
11-
# For hardare I2C (SAMD21/M0 boards):
12-
import nativeio as io
13-
# For software I2C (ESP8266):
14-
#import bitbangio as io
8+
import busio
9+
import pulseio
1510

1611
# Import MPR121 module.
1712
import adafruit_mpr121
@@ -36,15 +31,15 @@
3631

3732

3833
# Create I2C bus.
39-
i2c = io.I2C(board.SCL, board.SDA)
34+
i2c = busio.I2C(board.SCL, board.SDA)
4035

4136
# Create MPR121 class.
4237
mpr121 = adafruit_mpr121.MPR121(i2c)
4338
# Note you can optionally change the address of the device:
4439
#mpr121 = adafruit_mpr121.MPR121(i2c, address=0x91)
4540

4641
# Setup buzzer PWM output.
47-
buzzer = nativeio.PWMOut(BUZZER_PIN, duty_cycle=TONE_OFF_DUTY, frequency=440,
42+
buzzer = pulseio.PWMOut(BUZZER_PIN, duty_cycle=TONE_OFF_DUTY, frequency=440,
4843
variable_frequency=True)
4944

5045
# Main loop.

examples/simpletest.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
# Import MPR121 module.
88
import adafruit_mpr121
99

10-
# Uncomment _one_ of the following lines depending on how your board supports I2C.
11-
# For hardare I2C (SAMD21/M0 boards):
12-
import nativeio as io
13-
# For software I2C (ESP8266):
14-
#import bitbangio as io
10+
import busio
1511

1612
# Create I2C bus.
1713
import board
18-
i2c = io.I2C(board.SCL, board.SDA)
14+
i2c = busio.I2C(board.SCL, board.SDA)
1915

2016
# Create MPR121 class.
2117
mpr121 = adafruit_mpr121.MPR121(i2c)

0 commit comments

Comments
 (0)