Micropython LED blink berkedip

Micropython LED blink berkedip

for i in range(10): led.high() time.sleep(0.5) led.low() time.sleep(0.5) from machine import Pin import time led = Pin(14, Pin.OUT) time.sleep_ms

>>> import machine
>>> import time
>>> pin = machine.Pin(0, machine.Pin.OUT)
>>> for i in range(10):
...     pin.on()
...     time.sleep(0.5)
...     pin.off()
...     time.sleep(0.5)
for i in range(10):
    led.high()
    time.sleep(0.5)
    led.low()
    time.sleep(0.5)
from machine import Pin
import time

led = Pin(14, Pin.OUT)
for i in range(10):
    led.high()
    time.sleep_ms(500)
    led.low()
    time.sleep_ms(500)
from machine import Pin
led = Pin(2, Pin.OUT)
button = Pin(14, Pin.IN, Pin.PULL_UP)
while True:
    if not button.value():
        led.value(not led.value())
        while not button.value():
            pass

Sumber: learn.adafruit.com

Komentar