NodeMCU Projects: Difference between revisions

Content added Content deleted
Line 110: Line 110:




*Control a hobby servo
<syntaxhighlight lang="python">
servo = machine.PWM(machine.Pin(12), freq=50)
servo.duty(40)
servo.duty(115)
servo.duty(77)
</syntaxhighlight>


<syntaxhighlight lang="python">
servo = machine.PWM(machine.Pin(12), freq=50)
while True:
servo.duty(urandom.getrandbits(8))
time.sleep(1)
</syntaxhighlight>


<br />
<br />