Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
d6442407
Commit
d6442407
authored
Oct 13, 2015
by
Damien George
Browse files
docs: Fix formatting of DAC code examples.
parent
b5c43be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
docs/library/pyb.DAC.rst
View file @
d6442407
...
...
@@ -26,11 +26,11 @@ To output a continuous sine-wave::
# create a buffer containing a sine-wave
buf = bytearray(100)
for i in range(len(buf)):
buf[i] = 128 + int(127
\
* math.sin(2
\
* math.pi
\
* i / len(buf)))
buf[i] = 128 + int(127 * math.sin(2 * math.pi * i / len(buf)))
# output the sine-wave at 400Hz
dac = DAC(1)
dac.write_timed(buf, 400
\
* len(buf), mode=DAC.CIRCULAR)
dac.write_timed(buf, 400 * len(buf), mode=DAC.CIRCULAR)
To output a continuous sine-wave at 12-bit resolution::
...
...
@@ -43,7 +43,7 @@ To output a continuous sine-wave at 12-bit resolution::
# output the sine-wave at 400Hz
dac = DAC(1, bits=12)
dac.write_timed(buf, 400
\
* len(buf), mode=DAC.CIRCULAR)
dac.write_timed(buf, 400 * len(buf), mode=DAC.CIRCULAR)
Constructors
------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment