docs/esp8266: Update quickref to reflect changes to 1-wire and NeoPixel.

This commit is contained in:
Damien George 2016-04-28 14:31:37 +01:00
parent 8c3b5526ae
commit 348edad888
1 changed files with 9 additions and 10 deletions

View File

@ -235,10 +235,10 @@ The OneWire driver is implemented in software and works on all pins::
ow = onewire.OneWire(Pin(12)) # create a OneWire bus on GPIO12
ow.scan() # return a list of devices on the bus
ow.reset() # reset the bus
ow.read_byte() # read a byte
ow.read_bytes(5) # read 5 bytes
ow.write_byte(0x12) # write a byte on the bus
ow.write_bytes('123') # write bytes on the bus
ow.readbyte() # read a byte
ow.read(5) # read 5 bytes
ow.writebyte(0x12) # write a byte on the bus
ow.write('123') # write bytes on the bus
ow.select_rom(b'12345678') # select a specific device by its ROM code
There is a specific driver for DS18B20 devices::
@ -246,12 +246,14 @@ There is a specific driver for DS18B20 devices::
import time
ds = onewire.DS18B20(ow)
roms = ds.scan()
ds.start_measure()
ds.convert_temp()
time.sleep_ms(750)
for rom in roms:
print(ds.get_temp(rom))
print(ds.read_temp(rom))
Be sure to put a 4.7k pull-up resistor on the data line.
Be sure to put a 4.7k pull-up resistor on the data line. Note that
the ``convert_temp()`` method must be called each time you want to
sample the temperature.
NeoPixel driver
---------------
@ -267,9 +269,6 @@ 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::
import esp