ESP32-S3 如果是要蓝牙和手机app通讯的,应该用哪一个例程?
Posted: Thu Mar 31, 2022 5:55 am
by 122722629@qq.com
有很多例程,不知道用哪一个好,谢谢了
- 微信截图_20220331135450.png (60.19 KiB) Viewed 3505 times
Re: ESP32-S3 如果是要蓝牙和手机app通讯的,应该用哪一个例程?
Posted: Thu Mar 31, 2022 7:18 am
by 122722629@qq.com
试了一下gatt_server_service_table例程
虽然,可以收发数据,但是发送(手机端读取)只能是固定的
static const uint8_t char_value[4] = {0x11, 0x22, 0x33, 0x44};
如果需要可以手机正常收发通讯的,应该用哪个例程?
Re: ESP32-S3 如果是要蓝牙和手机app通讯的,应该用哪一个例程?
Posted: Thu Mar 31, 2022 8:24 am
by 898791901@qq.com
gatt_client
Re: ESP32-S3 如果是要蓝牙和手机app通讯的,应该用哪一个例程?
Posted: Thu Mar 31, 2022 9:09 am
by 122722629@qq.com
while(true)
{
if( gatts_info.bEnable )
{
i++ ;
buf[0] = i >> 24 ;
buf[1] = i >> 16 ;
buf[2] = i >> 8 ;
buf[3] = i ;
esp_err_t t = esp_ble_gatts_send_indicate(gatts_info.gatts_if , gatts_info.conn_id, gatts_info.attr_handle ,
sizeof(buf), buf, false);
ESP_LOGI(GATTS_TABLE_TAG,"send %d ,ret %d",i,t);
}
vTaskDelay(500);
}
已经可以发数据了,通过这个函数发数据。