from microbit import *
from random import randint
shapes = "TIJLOSZTIJLOSZTIJLOSZTIJLOSZTIJLOSZT "
display.show("-")
while True:
if button_a.was_pressed():
display.show(" ")
sleep(100)
ln = len(shapes)
if ln == 1:
break
r = randint(0,ln-2)
display.show(shapes[r])
if r == 0:
shapes = shapes[1:]
else:
shapes = shapes[0:r] + shapes[r+1:]
display.show("=")
由於 MicroPython 不是一般 Python,它只提供精簡版的函數庫,所以不足的功能要自己寫。上面的程式每按一次 A 鍵,隨機抽一個拼塊,因此程式將 36 個拼塊依序排列一字串,亂數隨機抽一個,被抽到的字塊拿掉,未被抽走的字塊再合併成一字串,再隨機抽籤,直到抽完為止。
[技術教學文]-讓 Jetson Orin 看懂世界!Live VLM WebUI 即時視覺 AI 教學
-
撰寫/攝影 郭俊廷 時間 1H(根據網路速度決定時間) 材料表 JETSON ORIN系列套件 reCompu [...]
〈[技術教學文]-讓 Jetson Orin 看懂世界!Live VLM WebUI 即時視覺 AI 教學〉這篇文章最早發佈於《
CAVEDU教育團隊技術部落格》。
1 天前
沒有留言:
張貼留言