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
$
訂閱:
張貼留言 (Atom)
2024_09 作業3 以Node-Red 為主
2024_09 作業3 (以Node-Red 為主 Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker 2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...
-
python pip 不是内部或外部命令 -- 解決方法 要安裝 Pyqt5 1. 首先,開啟命令提示字元。 2. 輸入 pip3 install pyqt5 好像不能執行 ! ! 錯誤顯示 : ‘ pip3 ’ 不是內部或外部命令、可執行的程式或批...
-
課程講義 下載 11/20 1) PPT 下載 + 程式下載 http://www.mediafire.com/file/cru4py7e8pptfda/106%E5%8B%A4%E7%9B%8A2-1.rar 11/27 2) PPT 下載...
-
• 認 識 PreFix、InFix、PostFix PreFix(前序式):* + 1 2 + 3 4 InFix(中序式): (1+2)*(3+4) PostFix(後序式):1 2 + 3 4 + * 後 序式的運算 例如: 運算時由 後序式的...
沒有留言:
張貼留言