wemos D1採集JY 61六軸姿態感測器

2021-10-01 07:08:08 字數 489 閱讀 3052

wemos d1只有乙個半串列埠,由於我需要用電腦顯示獲取的資料,該串列埠被占用了,所以需要採用軟串列埠來獲取jy-61資料。

關於軟串列埠的相關知識可以參看softwareserial。

#include #include #includesoftwareserial espserial(14,12);//rx,tx

void setup()

void loop()

void serialevent()

}

serialevent()為硬串列埠使用的偽中斷,使用軟串列埠後無法呼叫,需要在loop()中主動調入才能將程式正常進行。

enjoy!

JY 61模組的指令

z軸歸零 ff aa 52 加速度校準 ff aa 67 休眠 ff aa 60 波特率設定 9600 ff aa 64 115200 ff aa 63 模式串列埠 ff aa 61 iic ff aa 62 靜止閾值檢測 0.122 s ff aa 71 0.224 s ff aa 72 0.33...

Wemos D1 超聲測距

四個引腳 vcc 正極 trig 觸發 echo 回應 gdn 接地 define echo d2 define trig d8 long gettime pulsein函式會等待引腳變為high,開始計算時間,再等待變為low並停止計時 返回脈衝的長度 聲速是 340m 1s 換算成 34000c...

wemos d1 採集溫度資料上傳到mqtt伺服器

用到的硬體 1.wemos d1板。2.dh1感測器。3.樹莓派。實驗步驟 1.樹莓派安裝mqtt伺服器,並驗證。2.wemos 連線dh1測試。dh1感測器有四個引腳連線如下圖 wemos 如下 include include include dht.h define dhtpin d4 定義感測...