寫程式41.jpg

💽影片名稱:[Arduino寫程式] 第41集 - 藍牙控制 AT設定

🎬集數:41集🎤背景音樂:TheFatRat - Fly Away feat. Anjulie🎤背景音樂:TheFatRat - Monody (feat. Laura Brehm) 🎤背景音樂:TheFatRat - Windfall [Tasty Release]💕若有問題歡迎在下方留言💬讓我知道~😋


🌐(前往YouTube觀看)-[ https://youtu.be/DXjioepqNv0?feature=shared ]

🌐(YouTube播放清單)-[ https://youtube.com/playlist?list=PLOrdAySpFIQonYKEWANFiVrICDQY8R0_1&feature=shared ]


🌐程式創造++ 頻道:[ https://www.youtube.com/@CCplus2561 ]🌐Arduino程式語法網頁:[ https://www.86duino.com/?page_id=2255&lang=TW ]


[電路圖]

寫程式41 - 藍芽控制 AT設定 電路圖.png

▲ 電路圖@CCplus2561 提供

 

寫程式41 - 藍芽控制 AT設定 素材1.png

▲ AT指令@CCplus2561 製表提供

 

寫程式41 - 藍芽控制 AT設定 素材2.png

▲ 此素材由 Google 提供


[程式碼]

EX01: 設定AT指令

# include <SoftwareSerial.h>  //藍芽函式庫
SoftwareSerial BT(10,11);     //藍芽腳位 RX11 TX10

void setup(){
   Serial.begin(9600);        //PC傳輸速度
   BT.begin(38400);           //藍芽傳輸速度
   Serial.println("輸入AT指令:");
}

void loop(){
   if(BT.available())       //假如藍芽回傳資料進來
   Serial.write(BT.read()); //讀取藍芽資料並再序列附視窗顯示
   if(Serial.available())   //假如arduino資料出去
   BT.write(Serial.read()); //將資料傳給藍芽
}

創作者介紹
創作者 Code Create++ 的頭像
程式創造++

Code Create++

程式創造++ 發表在 痞客邦 留言(0) 人氣( 0 )