NodeMCU Projects: Difference between revisions

Content added Content deleted
Line 56: Line 56:


<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
import machine
import machine
import time
import time


pin = machine.Pin(2, machine.Pin.OUT)
pin = machine.Pin(2, machine.Pin.OUT)


def toggle(p):
def toggle(p):
p.value(not p.value())
p.value(not p.value())


while True:
while True:
for i in range(100,999):
for i in range(100,999):
time.sleep_ms(i)
time.sleep_ms(i)
toggle(pin)
toggle(pin)
</syntaxhighlight>
</syntaxhighlight>