summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp8266/quickref.rst
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-04-28 14:31:37 +0100
committerDamien George <damien.p.george@gmail.com>2016-04-28 14:31:37 +0100
commit348edad88821e0bf8c1e0c1ae03b91dd889beb74 (patch)
tree25dd8711d605c729b8828ad794eb90da888bb52f /docs/esp8266/quickref.rst
parent8c3b5526aee160f5dd7d836f4666a874e4c3212e (diff)
downloadmicropython-348edad88821e0bf8c1e0c1ae03b91dd889beb74.tar.gz
micropython-348edad88821e0bf8c1e0c1ae03b91dd889beb74.zip
docs/esp8266: Update quickref to reflect changes to 1-wire and NeoPixel.
Diffstat (limited to 'docs/esp8266/quickref.rst')
-rw-r--r--docs/esp8266/quickref.rst19
1 files 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