Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
348edad8
Commit
348edad8
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
docs/esp8266: Update quickref to reflect changes to 1-wire and NeoPixel.
parent
8c3b5526
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/esp8266/quickref.rst
+9
-10
9 additions, 10 deletions
docs/esp8266/quickref.rst
with
9 additions
and
10 deletions
docs/esp8266/quickref.rst
+
9
−
10
View file @
348edad8
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment