From 348edad88821e0bf8c1e0c1ae03b91dd889beb74 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 28 Apr 2016 14:31:37 +0100 Subject: [PATCH] docs/esp8266: Update quickref to reflect changes to 1-wire and NeoPixel. --- docs/esp8266/quickref.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/esp8266/quickref.rst b/docs/esp8266/quickref.rst index 30687db710..b80d456e2c 100644 --- a/docs/esp8266/quickref.rst +++ b/docs/esp8266/quickref.rst @@ -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