We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 698a6a9 commit 9d0d6d3Copy full SHA for 9d0d6d3
1 file changed
examples/accel_i2c.py
@@ -4,16 +4,17 @@
4
# example. For the latter, using pyb.Accel class is
5
# much easier.
6
7
-import pyb
+from machine import Pin
8
+from machine import I2C
9
import time
10
11
# Accelerometer needs to be powered on first. Even
12
# though signal is called "AVDD", and there's separate
13
# "DVDD", without AVDD, it won't event talk on I2C bus.
-accel_pwr = pyb.Pin("MMA_AVDD")
14
+accel_pwr = Pin("MMA_AVDD")
15
accel_pwr.value(1)
16
-i2c = pyb.I2C(1)
17
+i2c = I2C(1, baudrate=100000)
18
addrs = i2c.scan()
19
print("Scanning devices:", [hex(x) for x in addrs])
20
if 0x4c not in addrs:
0 commit comments