diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-11-29 02:56:02 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-11-29 02:56:26 +0200 |
commit | 9d0d6d38306e37e66938322024ea9784e7530801 (patch) | |
tree | f82970eaa891b661912e2c150d19370cde13f392 | |
parent | 698a6a9d7d8d9f4bf90287ddf60ebf5325167ec8 (diff) | |
download | micropython-9d0d6d38306e37e66938322024ea9784e7530801.tar.gz micropython-9d0d6d38306e37e66938322024ea9784e7530801.zip |
examples/accel_i2c.py: Switch to "machine" module.
-rw-r--r-- | examples/accel_i2c.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/accel_i2c.py b/examples/accel_i2c.py index 2c5f4a0770..d635e3ccc1 100644 --- a/examples/accel_i2c.py +++ b/examples/accel_i2c.py @@ -4,16 +4,17 @@ # example. For the latter, using pyb.Accel class is # much easier. -import pyb +from machine import Pin +from machine import I2C import time # Accelerometer needs to be powered on first. Even # though signal is called "AVDD", and there's separate # "DVDD", without AVDD, it won't event talk on I2C bus. -accel_pwr = pyb.Pin("MMA_AVDD") +accel_pwr = Pin("MMA_AVDD") accel_pwr.value(1) -i2c = pyb.I2C(1) +i2c = I2C(1, baudrate=100000) addrs = i2c.scan() print("Scanning devices:", [hex(x) for x in addrs]) if 0x4c not in addrs: |