Skip to content

Commit 13c5a22

Browse files
committed
docs/esp8266: Update quickref and tutorial for OneWire/DS18X20 driver.
1 parent 59a9509 commit 13c5a22

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

docs/esp8266/quickref.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,14 @@ The OneWire driver is implemented in software and works on all pins::
253253
ow.scan() # return a list of devices on the bus
254254
ow.reset() # reset the bus
255255
ow.readbyte() # read a byte
256-
ow.read(5) # read 5 bytes
257256
ow.writebyte(0x12) # write a byte on the bus
258257
ow.write('123') # write bytes on the bus
259258
ow.select_rom(b'12345678') # select a specific device by its ROM code
260259

261-
There is a specific driver for DS18B20 devices::
260+
There is a specific driver for DS18S20 and DS18B20 devices::
262261

263-
import time
264-
ds = onewire.DS18B20(ow)
262+
import time, ds18x20
263+
ds = ds18x20.DS18X20(ow)
265264
roms = ds.scan()
266265
ds.convert_temp()
267266
time.sleep_ms(750)

docs/esp8266/tutorial/onewire.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ The 1-wire bus is a serial bus that uses just a single wire for communication
66
is a very popular 1-wire device, and here we show how to use the onewire module
77
to read from such a device.
88

9-
For the following code to work you need to have at least one DS18B20 temperature
9+
For the following code to work you need to have at least one DS18S20 or DS18B20 temperature
1010
sensor with its data line connected to GPIO12. You must also power the sensors
1111
and connect a 4.7k Ohm resistor between the data pin and the power pin. ::
1212

1313
import time
1414
import machine
15-
import onewire
15+
import onewire, ds18x20
1616

1717
# the device is on GPIO12
1818
dat = machine.Pin(12)
1919

2020
# create the onewire object
21-
ds = onewire.DS18B20(onewire.OneWire(dat))
21+
ds = ds18x20.DS18X20(onewire.OneWire(dat))
2222

2323
# scan for devices on the bus
2424
roms = ds.scan()

0 commit comments

Comments
 (0)