用樹莓派實作空氣盒子
編輯歷史
| 時間 | 作者 | 版本 |
|---|---|---|
| 2017-07-19 14:02 – 14:02 | r2 – r3 | |
顯示 diff(167 行未修改)
|
||
| 2017-07-19 13:37 – 13:37 | r0 – r1 | |
顯示 diff+ 用樹莓派實作空氣盒子
+ *Week 5
+ 各組成績
+ https://goo.gl/R1Jbft
+
+ *Week 4
+ 電錶
+ 測量電壓電阻
+
+ 麵包板
+ +電阻器
+ +LED
+
+ 電阻分壓
+
+ GPIO(General Purpose Input Output)
+ https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/README.md
+
+ 寫程式
+ *import RPi.GPIO as GPIO
+ *import time
+ *GPIO.setmode(GPIO.BOARD)
+ *LED_R = 36
+ *LED_Y = 38
+ *LED_G = 40
+ *GPIO.setup(LED_R, GPIO.OUT)
+ *GPIO.setup(LED_Y, GPIO.OUT)
+ *GPIO.setup(LED_G, GPIO.OUT)
+ *try:
+ * while True:
+ * GPIO.output(LED_R, GPIO.HIGH)
+ * print('RED on')
+ * time.sleep(1)
+ * GPIO.output(LED_R, GPIO.LOW)
+ * print('RED off')
+ * GPIO.output(LED_Y, GPIO.HIGH)
+ * print('YELLOW on')
+ * time.sleep(1)
+ * GPIO.output(LED_Y, GPIO.LOW)
+ * print('YELLOW off')
+ * GPIO.output(LED_G, GPIO.HIGH)
+ * print('GREEN on')
+ * time.sleep(1)
+ * GPIO.output(LED_G, GPIO.LOW)
+ * print('GREEN off')
+ *finally:
+ * GPIO.cleanup()
+
+ *Week 3
+ 科學日資電組狗狗派
+ http://gogo.1001000.io
+
+ 樹莓派
+ 帳號:pi
+ 密碼:raspberry
+ rdp進樹莓派桌面(Desktop)
+ ssh進樹莓派終端機(Terminal)
+ ssh pi@172.19.16.XXX
+
+ 重開機指令
+ sudo reboot now
+
+ python3 your_first_script.py
+ 用Ubuntu的檔案應用程式連接伺服器 ssh://172.19.16.XXX
+ 用Ubuntu的gedit編輯樹莓派上的script
+ *x = input('請輸入最小被乘數:')
+ *y = input('請輸入最小乘數:')
+ *X = input('請輸入最大被乘數:')
+ *Y = input('請輸入最大乘數:')
+ *for i in range(int(x),int(X)+1):
+ * for j in range(int(y),int(Y)+1):
+ * print( i, 'times', j, 'equals', i*j)
+
+ 關機指令
+ sudo shutdown now
+
+ *Week 2
+ Terminal指令
+ ls
+ *簡易list所有檔案及目錄
+ ll
+ *詳細list所有檔案及目錄
+ touch 檔案名稱
+ *新增檔案
+ cd 目的路徑
+ *change directory 更換目錄
+ mv 原名稱 新名稱
+ *move改名或搬動
+ mkdir 資料夾名稱
+ *make directory 開資料夾
+ rm 檔案名稱
+ *remove 移除檔案
+ rm -rf 資料夾名稱
+ *remove 移除資料夾
+
+ 資料型態
+ *int
+ *float
+ *str
+ *list
+ *range
+ *dict
+ *x={'name':'python', 'age':16, 'gender':3, 'school':'Y416'}
+ *print(x)
+ *print(x.keys())
+ *print(x['age'])
+
+ 台北市公開資料
+ http://data.taipei
+ *import requests
+ *data = 'http://data.taipei/youbike'
+ *r = requests.get(data).json()
+ *#print(type(r))
+ *#print(r)
+ *#print(r.keys())
+ *#print(r['retVal'])
+ *print('行政區域:', r['retVal']['0268']['sarea'])
+ *print('中文站名:', r['retVal']['0268']['sna'])
+ *print('總停車格:', r['retVal']['0268']['tot'])
+ *print('目前數量:', r['retVal']['0268']['sbi'])
+ *print('空位數量:', r['retVal']['0268']['bemp'])
+
+ *Week 1
+ Schedule
+ Week 1 : Python + IDLE + repl.it
+ Week 2 : Python + Ubuntu + open data
+ Week 3 : Raspberry Pi
+ Week 4 : Raspberry Pi + LED
+ Week 5 : Raspberry Pi + Temp sensor + PM sensor
+
+ Maker
+ Maker board: Raspberry Pi
+ Operation System: Linux
+ Programming language: Python 3
+ Integrated Development Environment: IDLE
+
+ IDLE
+ 變數 variables
+ *int
+ *float
+ *str
+ 函數 functions
+ *print( )
+ *type( )
+ *int( )
+ *float( )
+ *len( )
+
+ repl.it
+ https://repl.it/languages/python3
+
+ *a=118
+ *a*=10
+ *if a<0:
+ * print('哈囉')
+ *elif 0<=a<100:
+ * print('你好')
+ *elif 100<=a<200:
+ * print('ALOHA!!!')
+ *else:
+ * print('How are you?')
+ Team up
+ 5 teams
+ find a helper
+ borrow a book or just google it
+ http://sololearn.com
|
||