or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
DHT11 to raspberry pi to webserver
需要的硬體設備
一台樹莓派 Raspberry Pi
一張SD卡(16G以上可能會比較好)
一條網路線(也可以透過設定檔做好wifi的連接就不需要網路線)
一顆DHT11感測模組
第一步: 下載 Adafruit_Python_DHT 套件
第二步: 進入剛剛所載的資料夾裡
第三步: 安裝 Adafruit_Python_DHT 套件
第四步: 檢查DHT11模組是否安裝好了
第五步:將DHT11模組跟Raspberry Pi對接
樹莓派3B針腳的腳位
第六步: 撰寫DHT11 .py
第七步:執行該python
第八步:安裝mariadb資料庫跟PHP有支援MySQL-PDO
第九步: 進入mysql
第十步:創建一個使用者讓他使用資料庫
第十一步:設定該使用者對資料庫的權限
第十二步:建立資料庫並進入該資料庫
第十三步:建立資料表
第十四步:輸入一筆資料進去剛剛的資料表
\q;資料庫登出
更改mysql的設定檔
加入底下兩行
這麼一來就不必輸入密碼就能進資料庫
安裝mysql.connector
第十五步:撰寫可以將數據上傳到資料庫的python
程式碼在底下
第十六步:查看mysql是否有資料進入
第十七步:撰寫可以將資料表的數據傳送到php網頁
程式碼在底下
第十八步:查看該網頁
第十九步:將數據網頁跟監控網頁寫在一起
請將程式碼放置在/var/www/html/底下檔案名稱叫index.php
/var/www/html/index.php程式碼
完成
參考網址
1. 『PHP學習筆記』系列七:讀取MySQL資料庫中的資料表