Ushbu mahsulotda Redpine Signals kompaniyasining Narasimxan Venkatesh o'rnatilgan dizaynga Wi-Fi ulanishini qo'shishda e'tiborga olish kerak bo'lgan asosiy ko'rsatmalar


Smartfoningizda bluetooth-ni yoqing va ESP32-ni ulang



Yüklə 0,5 Mb.
səhifə7/18
tarix07.01.2024
ölçüsü0,5 Mb.
#204249
1   2   3   4   5   6   7   8   9   10   ...   18
In this Product How

4. Smartfoningizda bluetooth-ni yoqing va ESP32-ni ulang.

Smartfonni ESP32test bilan ulang


5. ESP32 ga ulaning.
Ilovani oching > ESP32test-ni bosing > Quyidagi rasmda aylanada joylashgan yuqori tugmani bosing. Keyin siz "Ulangan" xabarini olishingiz kerak.




ESP32 testiga ulangan


6. Ikki qurilma oʻrtasida xabar almashishga harakat qiling.
Serial Bluetooth Terminal ilovasida biror narsa yozing va siz bu xabarni darhol Arduino IDE Serial Monitor-da olishingiz kerak. Shuningdek, siz xabarni Serial Monitordan yuborishingiz va ushbu xabarni smartfoningizdagi Serial Bluetooth Terminal ilovasida bir zumda olishingiz mumkin.




E
SP32 uchun smartfon



Smartfon uchun ESP32


-loyiha : Smartfondan LEDni yoqish va o'chirish
Loyihaning ikkinchi qismi uchun quyidagi amallarni bajaring!
1
. Quyidagi ilova qilingan rasmga muvofiq sxemani joylashtiring.

LED bilan sxematik tartibga solish


Pinout:

  1. ESP32 GND pin - Breadboard salbiy qutb

  2. ESP32 3V3 pin - Breadboard musbat qutb

  3. ESP32 GPIO5 pin - LED musbat pin


  4. LED salbiy pin - Breadboard salbiy qutb

Sizning tartibingiz shunday ko'rinishi kerak.




M

alumot uchun mening kelishuvim2. Serial Bluetooth Terminal ilovasining M1 va M2 tugmalarining qiymatini o'rnating.M1 va M2 tugmalarining qiymatini o'rnating


3. Quyidagi kodni nusxalash, kompilyatsiya qilish va yuklash.
#include
// Check if Bluetooth configs are enabled
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
// Bluetooth Serial object
BluetoothSerial SerialBT;
// GPIO where LED is connected to
const int ledPin = 5;
// Handle received and sent messages
String message = "";
char incomingChar;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
// Bluetooth device name
SerialBT.begin("ESP32");
Serial.println("The device started, now you can pair it with bluetooth!");
}
void loop() {
unsigned long currentMillis = millis();
// Read received messages (LED control command)
if (SerialBT.available()){
char incomingChar = SerialBT.read();
if (incomingChar != '\n'){
message += String(incomingChar);
}
else{
message = "";
}
Serial.write(incomingChar);
}
// Check received message and control output accordingly
if (message == "led_on"){
digitalWrite(ledPin, HIGH);
}
else if (message == "led_off"){
digitalWrite(ledPin, LOW);
}
delay(20);
}

Yüklə 0,5 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   10   ...   18




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin