2017年2月8日 星期三

Micropython esp8266 LED Blink

Micropython esp8266 LED Blink


User@User-PC MINGW64 /c/mini3
$ ampy --port COM8 run test3-2.py


User@User-PC MINGW64 /c/mini3
$ cat test3-2.py

from machine import Pin
import time
leds =  [Pin(i, Pin.OUT) for i in range (2,6)]

while True:
     leds[0].value(1)
     leds[1].value(1)
     leds[2].value(1)
     time.sleep(0.5)
     leds[0].value(0)
     leds[1].value(0)
     leds[2].value(0)
     time.sleep(0.5)

#====================================================================
# from machine import Pin
# p0 = Pin(0, Pin.OUT)    # create output pin on GPIO0
# p0.high()               # set pin to high
# p0.low()                # set pin to low
# p0.value(1)             # set pin to high
#
# p2 = Pin(2, Pin.IN)     # create input pin on GPIO2
# print(p2.value())       # get value, 0 or 1

# p4 = Pin(4, Pin.IN, Pin.PULL_UP) # enable internal pull-up resistor
# p5 = Pin(5, Pin.OUT, value=1) # set pin high on creation
# Available pins are: 0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 16,
# which correspond to the actual GPIO pin numbers of ESP8266 chip
# Note that Pin(1) and Pin(3) are REPL UART TX and RX respectively.
# Also note that Pin(16) is a # special pin (used for wakeup from deepsleep mode)
# and may be not available for use with higher-level classes like
#=====================================================================


User@User-PC MINGW64 /c/mini3
$


沒有留言:

張貼留言

WOKWI DHT22 & LED , Node-Red + SQLite database

 WOKWI DHT22 & LED , Node-Red + SQLite database Node-Red程式 [{"id":"6f0240353e534bbd","type":"comment&...