Jump to content

NodeMCU Projects: Difference between revisions

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 />
Cookies help us deliver our services. By using our services, you agree to our use of cookies.