kopia lustrzana https://github.com/micropython/micropython
docs: Fix formatting of DAC code examples.
rodzic
b5c43be135
commit
d6442407f5
|
@ -26,11 +26,11 @@ To output a continuous sine-wave::
|
||||||
# create a buffer containing a sine-wave
|
# create a buffer containing a sine-wave
|
||||||
buf = bytearray(100)
|
buf = bytearray(100)
|
||||||
for i in range(len(buf)):
|
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
|
# output the sine-wave at 400Hz
|
||||||
dac = DAC(1)
|
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::
|
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
|
# output the sine-wave at 400Hz
|
||||||
dac = DAC(1, bits=12)
|
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
|
Constructors
|
||||||
------------
|
------------
|
||||||
|
|
Ładowanie…
Reference in New Issue