summaryrefslogtreecommitdiff
path: root/docs/esp8266
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-03-16 13:37:39 +0000
committerDamien George <damien.p.george@gmail.com>2016-03-16 13:37:39 +0000
commit2466cb67f831abef9425ec9c6b12cb8eeb8602b7 (patch)
treeee51fffbd39e6de0ae858d02f6d0455fabdc2267 /docs/esp8266
parent3acaa28b52587bace3a4e8382fbf06ed6f6e4aaf (diff)
docs/esp8266: Update quick reference: i2c.readfrom and neopixel example.
Diffstat (limited to 'docs/esp8266')
-rw-r--r--docs/esp8266/quickref.rst7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/esp8266/quickref.rst b/docs/esp8266/quickref.rst
index 6f5913f1c..30359cd5c 100644
--- a/docs/esp8266/quickref.rst
+++ b/docs/esp8266/quickref.rst
@@ -183,15 +183,15 @@ The I2C driver is implemented in software and works on all pins::
# construct an I2C bus
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
+ i2c.readfrom(0x3a, 4) # read 4 bytes from slave device with address 0x3a
i2c.writeto(0x3a, '12') # write '12' to slave device with address 0x3a
buf = bytearray(10) # create a buffer with 10 bytes
i2c.writeto(0x3a, buf) # write the given buffer to the slave
+ i2c.readfrom(0x3a, 4, stop=False) # don't send a stop bit after reading
i2c.writeto(0x3a, buf, stop=False) # don't send a stop bit after writing
-Note that reading is not yet implemented.
-
OneWire driver
--------------
@@ -227,7 +227,7 @@ NeoPixel driver
Use the ``neopixel`` module::
from machine import Pin
- import neopixel
+ from neopixel import NeoPixel
pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels
np = NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixels
@@ -235,6 +235,7 @@ Use the ``neopixel`` module::
np.write() # write data to all pixels
r, g, b = np[0] # get first pixel colour
+ import neopixel
neopixel.demo(np) # run a demo
For low-level driving of a NeoPixel::