Cov txheej txheem:

ESP32 Bluetooth Tutorial - Yuav Siv Li Cas Inbuilt Bluetooth ntawm ESP32: 5 Cov Kauj Ruam
ESP32 Bluetooth Tutorial - Yuav Siv Li Cas Inbuilt Bluetooth ntawm ESP32: 5 Cov Kauj Ruam

Video: ESP32 Bluetooth Tutorial - Yuav Siv Li Cas Inbuilt Bluetooth ntawm ESP32: 5 Cov Kauj Ruam

Video: ESP32 Bluetooth Tutorial - Yuav Siv Li Cas Inbuilt Bluetooth ntawm ESP32: 5 Cov Kauj Ruam
Video: ESP32 Bluetooth Classic with Arduino IDE - Getting Started 2024, Hlis ntuj nqeg
Anonim
ESP32 Bluetooth Tutorial | Yuav Siv Li Cas Inbuilt Bluetooth ntawm ESP32
ESP32 Bluetooth Tutorial | Yuav Siv Li Cas Inbuilt Bluetooth ntawm ESP32

Nyob zoo cov phooj ywg Txij li ESP32 Pawg Thawj Coj los nrog WiFi & Bluetooth ob qho tib si tab sis rau peb Cov Haujlwm Feem ntau peb feem ntau siv tsuas yog Wifi, peb tsis siv Bluetooth. Cov phiaj xwm yooj yim Bluetooth yog qhov ua tau zoo dua ntawm ESP32 los siv.

Kauj Ruam 1: Yam Koj Xav Tau

Yam Koj Xav Tau
Yam Koj Xav Tau

Yog li rau txoj haujlwm no koj tsuas yog xav tau: ESP32 (TXHUA YAM): Thiab cable rau Program nws.

Kauj Ruam 2: Teeb Arduino Lub Tswv Yim rau ESP 32

Teeb tsa Arduino Lub Tswv Yim rau ESP 32
Teeb tsa Arduino Lub Tswv Yim rau ESP 32

Nco ntsoov tias koj muaj Arduino IDE hauv koj lub PC thiab koj tau teeb tsa ESP32 Boards hauv koj Arduino IDE, thiab yog tias nws tsis yog qhov xwm txheej thov ua raws cov lus qhia hauv qab no ntawm kuv kom nruab nws.: https://www.instructables.com/id/Getting-Started-W …

Kauj ruam 3: Tau txais Bluetooth App

Tau txais Bluetooth App
Tau txais Bluetooth App

Ua ntej peb mus txuas ntxiv kom ntseeg tau tias koj muaj daim ntawv thov Bluetooth txuas hauv koj lub xov tooj ntawm tes rau BLUETOOTH kev sib txuas lus nrog txhua lub cuab yeej BLUETOOTH hauv peb rooj plaub ESP32.

Kauj Ruam 4: Coding Tshooj

Coding Tshooj
Coding Tshooj

Qhib koj arduino ide.go rau File> Piv txwv> BluetoothSerial> SerialtoSerialBT. Or luam cov cai hauv qab no: #include "BluetoothSerial.h" #if! Txhais tau tias (CONFIG_BT_ENABLED) || ! txhais (CONFIG_BLUEDROID_ENABLED)#tsis txaus ntseeg Bluetooth tsis tau qhib! Thov khiav 'ua menuconfig` rau thiab qhib nws#endifBluetoothSerial SerialBT; tsis muaj teeb tsa () {Serial.begin (115200); SerialBT.begin ("ESP32test"); // Bluetooth ntaus ntawv lub npe Serial.println ("Lub cuab yeej pib, tam sim no koj tuaj yeem txuas nws nrog bluetooth!");} Lub voj void () {yog (Serial.available ()) {SerialBT.write (Serial.read ()); } yog (SerialBT.available ()) {Serial.write (SerialBT.read ()); } ncua (20);} Txoj cai tau yooj yim heev thiab zoo ib yam li BLUETOOTH code peb feem ntau siv nrog arduino uno & hc05Code piav qhia: Hauv qab kab no suav nrog BluetoothSerial lub tsev qiv ntawv.#suav nrog "BluetoothSerial.h" 3 kab muab hauv qab no ua rau Bluetooth# yog! txhais (CONFIG_BT_ENABLED) || ! txhais (CONFIG_BLUEDROID_ENABLED)#tsis txaus ntseeg Bluetooth tsis tau qhib! Thov khiav `ua menuconfig` rau thiab ua kom nws#endifThen, piv txwv ntawm BLUETOOTH yog tsim BluetoothSerial SerialBT; Hauv teeb (), kev sib txuas lus txuas tau pib ntawm baud tus nqi ntawm 115200. Serial.begin (115200); Pib lub Bluetooth ntaus ntawv txuas thiab dhau raws li kev sib cav ntawm Bluetooth Device lub npe. Los ntawm lub neej ntawd nws hu ua ESP32test tab sis koj tuaj yeem hloov nws thiab muab nws lub npe tshwj xeeb. SerialBT.begin ("ESP32test"); // Bluetooth device nameIn the loop (), xa thiab tau txais cov ntaub ntawv ntawm Bluetooth Serial Hauv kab hauv qab no ntawm cov cai nws yuav tshuaj xyuas yog tias muaj cov ntaub ntawv muaj nyob ntawm cov saib xyuas yog tias yog ces nws yuav xa cov ntaub ntawv mus rau BLUETOOTH ntaus ntawv (piv txwv li: peb lub xov tooj smartphone) siv esp32's Bluetooth.if (Serial.available ()) {SerialBT.write (Serial.read ());} SerialBT.write () xa cov ntaub ntawv siv bluetooth serial. Serial.read () rov qab cov ntaub ntawv tau txais hauv Qhov chaw nyob hauv qab no ib feem ntawm cov cai yuav tshuaj xyuas yog tias muaj cov ntaub ntawv los ntawm Bluetooth yog tias nws yog tom qab ntawd nws yuav luam tawm ntawm cov ntawv xov xwm.if (SerialBT.available ()) {Serial.write (SerialBT.read ());) Yog li ntawd yog txhua qhov kev piav qhia yooj yim ntawm txoj cai. Yog li tam sim no koj tuaj yeem xa cov cai rau koj li ESP32.

Kauj Ruam 5: Xeem Bluetooth ntawm Esp32

Kuaj Bluetooth ntawm Esp32
Kuaj Bluetooth ntawm Esp32
Kuaj Bluetooth ntawm Esp32
Kuaj Bluetooth ntawm Esp32
Kuaj Bluetooth ntawm Esp32
Kuaj Bluetooth ntawm Esp32

Tom qab rub tawm cov cai qhib saib hauv koj Arduino IDE & tom qab ntawd txuas lub Bluetooth (esp32) los ntawm koj lub xov tooj. Thiab hauv cov cuab yeej ntu ntawm app koj tuaj yeem txuas rau ESP32 thiab tom qab ntawd koj yuav tau txais cov lus "txuas rau ESP32". vib nas this nws yuav txuas nrog thiab koj yuav pom cov lus ESP32 txuas nrog. Tom qab ntawd yog tias koj ntaus nyob zoo los ntawm app tom qab ntawd hauv koj li kev saib xyuas ntawm Koj li Arduino IDE koj tuaj yeem pom cov lus nyob zoo & yog tias koj ntaus koj li cas los ntawm koj tus lej saib xyuas koj tuaj yeem pom cov lus ntawd hauv Koj li App. Yog li no koj tuaj yeem tsim kev sib txuas Bluetooth nrog ESP32 thiab koj tuaj yeem siv yog tias muaj xwm txheej los ua cov haujlwm sib txawv rau cov lus sib txawv uas koj tau xa mus rau esp32 los ntawm koj lub xov tooj. Yog li muaj kev lom zem siv ESP32 Bluetooth hauv koj cov phiaj xwm.

Pom zoo: