circuitpython 编程的提示和技巧
<p><strong>circuitpython</strong> 编程的一些技巧和提示:</p><p><br />
Read an digital input as a Button</p>
<pre>
<code class="language-python">import board
from digitalio import DigitalInOut, Pull
button = DigitalInOut(board.D3) # defaults to input
button.pull = Pull.UP # turn on internal pull-up resistor
print(button.value)# False == pressed</code></pre>
<p> Read a Potentiometer</p>
<pre>
<code class="language-python">import board
import analogio
potknob = analogio.AnalogIn(board.A1)
position = potknob.value# ranges from 0-65535
pos = potknob.value // 256# make 0-255 range</code></pre>
<p> </p>
<p>**** Hidden Message *****</p>
<p>circuitpython 编程的提示和技巧,太好啊</p>
页:
[1]