How To Check If A Serial Port Is Active.Sprintf(spp_data, "Receined characters: %d\n", param->data_ind.len) Įsp_spp_write(param->write.handle, strlen(spp_data), (uint8_t *)spp_data) Įsp_log_buffer_hex("",param->data_ind.data,param->data_ind.len) If (param->data_ind.len data_ind.len, (char *)param->data_ind.data) Param->data_ind.len, param->data_ind.handle) Static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)Įsp_bt_dev_set_device_name(EXCAMPLE_DEVICE_NAME) Įsp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE) Įsp_spp_start_srv(sec_mask,role_slave, 0, SPP_SERVER_NAME) ĮSP_LOGI(SPP_TAG, "ESP_SPP_DISCOVERY_COMP_EVT") ĮSP_LOGI(SPP_TAG, "ESP_SPP_CL_INIT_EVT") ĮSP_LOGI(SPP_TAG, "ESP_SPP_DATA_IND_EVT len=%d handle=%d", Static const esp_spp_role_t role_slave = ESP_SPP_ROLE_SLAVE įloat time_old_s = time_old.tv_sec time_old.tv_usec / 1000000.0 įloat time_new_s = time_new.tv_sec time_new.tv_usec / 1000000.0 įloat time_interval = time_new_s - time_old_s įloat speed = data_num * 8 / time_interval / 1000.0 ĮSP_LOGI(SPP_TAG, "speed(%fs ~ %fs): %f kbit/s", time_old_s, time_new_s, speed) Static const esp_spp_sec_t sec_mask = ESP_SPP_SEC_NONE Static struct timeval time_new, time_old Static const esp_spp_mode_t esp_spp_mode = ESP_SPP_MODE_CB #define SPP_SHOW_MODE SPP_SHOW_DATA /*Choose show mode: show data or speed*/ #define EXCAMPLE_DEVICE_NAME "ESP_SPP_ACCEPTOR" Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES ORĬONDITIONS OF ANY KIND, either express or implied. Unless required by applicable law or agreed to in writing, this This example code is in the Public Domain (or CC0 licensed, at your option.) There is a bt_discovery example on GitHub to see a list of discoverable devices.įeel free to ask if something is not clear. There is code available on Qita from which i started to directly connect to a device when the UUID is known (but has no buffer). It was a lot of work in the beginning to understand the code but now it finally works. I modified the Bluetooth Serial library with the SPP_initiator example from ESP32-IDF to have the buffer functionality of the library when data is being received. Trying to find what you are trying to interface with, some kind of EEG?Ĭorrect, I was trying to get the brainwave values from a Neurosky MindWave headset through the bluetooth conection. So you had to modify the bluetooth serial library to allow pairing etc, or did you change to a different library? How difficult is it? Is there a way to get a list of discoverable devices? I cannot seem to get the eSense values out of it which is sent every 1 second. I can only see the raw data that the headset sends over (every 2 ms). The only problem left is the data that i am receiving. I have changed the bluetooth serial library to allow connecting to the Mindwave headset. Yeah, currently it is working with arduino.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |