1.電路圖
2.設定參數
3.輸出波型
「智慧生活科技專業社群」由 Nantou.py 使用者社群與國立虎尾科技大學電機資訊學院共同維護,匯集關注Python、人工智慧、物聯網與智慧生活應用的教師、學生及實務工作者。本社群以「科技融入生活、教學連結場域、知識促進共好」為核心,分享Python程式設計、AI協作學習、AIoT、網際網路與雲端服務、智慧農業、福祉科技、永續發展及USR社會實踐等內容,並將技術導入課堂、社區與真實生活場域。部分文章運用生成式AI協助資料整理、內容架構、程式範例與文字潤飾,文章主題、場域經驗、內容查核及最終修訂則由作者與社群成員負責。我們期待透過人與AI協作,讓科技成為改善生活、連結世代、支持地方與實踐永續的力量。
2.HIVEMQ: https://www.mqtt-dashboard.com/
3.MQTT example:人物動作控制
4.Publish
Topic:AnimationCommand
Commands: Idle, Walking, Running, Dance, Death, Sitting, Standing, Jump, Yes, No, Wave, Punch, ThumbsUp
5.Subscribe:
Topic: AnimtionState
In the upper right corner of the picture above, we can see two light control buttons are 'toggle directional light' and 'toggle hemisphere light', separately. You can try it out and learn how the two different lights work. For directional light, it is used to gets emitted in a specific direction but the light source of the hemisphere light position is located directly above the scene and the color of the light will gradually change from the color of the sky to the color of the ground.
1. three.js example: three.js examples (threejs.org)
2.MQTT example:Light Control
3.Publish
Topic:LightControlinHTML
Command 1:toggleHemisphereLight
Command 2:toggleDirectionalLight
4.Subscribe:
Topic: LightControl
We use MQTTBOX to test the issuance of commands as follows.
Host:test.mosquitto.org
Protocol:mqtt/tcp
資料網站:臺中市列冊獨居老人人數及服務概況
資料格式:臺中市列冊獨居老人人數及服務概況_JSON
1.首先下載資料,並改名為JSON.json。
2.撰寫下列基本程式:
1 2 3 4 5 | import json f = open('JSON.json') data = json.load(f) print(data) f.close() |
1 2 3 4 5 | import json f = open('JSON.json', encoding="utf-8") data = json.load(f) print(data) f.close() |
1 2 3 4 5 6 7 8 9 | import json f = open('JSON.json', encoding="utf-8") data = json.load(f) data = data['ROOT']['RECORD'] for d in data: for r in d: print(r, ":", d[r]) print("\n") f.close() |
1 2 3 4 5 6 7 8 9 10 11 12 | import json f = open('JSON.json', encoding="utf-8") data = json.load(f) data = data['ROOT']['RECORD'] for d in data: for r in d: if r == "行政區" : print(d[r]) if r == "合計": print(d[r]) print("\n") f.close() |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import json f = open('JSON.json', encoding="utf-8") X=[] Y=[] data = json.load(f) data = data['ROOT']['RECORD'] for d in data: for r in d: if r == "行政區" : X.append(d[r]) if r == "合計": Y.append(d[r]) f.close() import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['mingliu'] plt.plot(X, Y) plt.ylabel('(人)') plt.show() |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import json f = open('JSON.json', encoding="utf-8") X=[] Y=[] data = json.load(f) data = data['ROOT']['RECORD'] for d in data: for r in d: if r == "行政區" : X.append(d[r]) if r == "合計": Y.append(int(d[r])) f.close() import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['mingliu'] plt.plot(X, Y) plt.ylabel('(人)') plt.show() |