From 2466cb67f831abef9425ec9c6b12cb8eeb8602b7 Mon Sep 17 00:00:00 2001 From: Damien George <damien.p.george@gmail.com> Date: Wed, 16 Mar 2016 13:37:39 +0000 Subject: [PATCH] docs/esp8266: Update quick reference: i2c.readfrom and neopixel example. --- docs/esp8266/quickref.rst | 7 ++++--- 1 file 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:: -- GitLab