Skip to content

Commit 2466cb6

Browse files
committed
docs/esp8266: Update quick reference: i2c.readfrom and neopixel example.
1 parent 3acaa28 commit 2466cb6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/esp8266/quickref.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ The I2C driver is implemented in software and works on all pins::
183183
# construct an I2C bus
184184
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)
185185

186+
i2c.readfrom(0x3a, 4) # read 4 bytes from slave device with address 0x3a
186187
i2c.writeto(0x3a, '12') # write '12' to slave device with address 0x3a
187188

188189
buf = bytearray(10) # create a buffer with 10 bytes
189190
i2c.writeto(0x3a, buf) # write the given buffer to the slave
190191

192+
i2c.readfrom(0x3a, 4, stop=False) # don't send a stop bit after reading
191193
i2c.writeto(0x3a, buf, stop=False) # don't send a stop bit after writing
192194

193-
Note that reading is not yet implemented.
194-
195195
OneWire driver
196196
--------------
197197

@@ -227,14 +227,15 @@ NeoPixel driver
227227
Use the ``neopixel`` module::
228228

229229
from machine import Pin
230-
import neopixel
230+
from neopixel import NeoPixel
231231

232232
pin = Pin(0, Pin.OUT) # set GPIO0 to output to drive NeoPixels
233233
np = NeoPixel(pin, 8) # create NeoPixel driver on GPIO0 for 8 pixels
234234
np[0] = (255, 255, 255) # set the first pixel to white
235235
np.write() # write data to all pixels
236236
r, g, b = np[0] # get first pixel colour
237237

238+
import neopixel
238239
neopixel.demo(np) # run a demo
239240

240241
For low-level driving of a NeoPixel::

0 commit comments

Comments
 (0)