ESP32 BLE Fails to Advertise or Get Detected by Mobile App in Temperature Monitoring Project

Hello guys ahv gotten to a new stage on my project simple temperature monitoring system using MicroPython on a Zephyr RTOS-supported microcontroller, such as the ESP32, and transmit the data over Bluetooth Low Energy (BLE) to a mobile app. Am currently transmit the temperature and humidity data over Bluetooth Low Energy (BLE) from the ESP32 to a mobile app but BLE fails to advertise or the mobile app does not detect the ESP32. Here's my code
import bluetooth
from machine import Pin
import dht

sensor = dht.DHT11(Pin(4))
ble = bluetooth.BLE()
ble.active(True)

def advertise():
adv_data = b'\x02\x01\x06' + b'\x03\x03\xaa\xfe'
ble.gap_advertise(100, adv_data)

def send_data(temp, hum):
data = "Temp: {}°C, Hum: {}%".format(temp, hum)
ble.gatts_notify(0, 0, data.encode('utf-8'))

advertise()

while True:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
send_data(temp, hum)
import bluetooth
from machine import Pin
import dht

sensor = dht.DHT11(Pin(4))
ble = bluetooth.BLE()
ble.active(True)

def advertise():
adv_data = b'\x02\x01\x06' + b'\x03\x03\xaa\xfe'
ble.gap_advertise(100, adv_data)

def send_data(temp, hum):
data = "Temp: {}°C, Hum: {}%".format(temp, hum)
ble.gatts_notify(0, 0, data.encode('utf-8'))

advertise()

while True:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
send_data(temp, hum)
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server