From bd1e96a7bc862d5ab666320a932f134f13e333e6 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 25 Apr 2024 21:32:49 +0100 Subject: [PATCH] retry --- ESPBMS.ino | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ESPBMS.ino b/ESPBMS.ino index 181d3ec..0e774ce 100644 --- a/ESPBMS.ino +++ b/ESPBMS.ino @@ -7,12 +7,13 @@ static BLEUUID charUUID_tx("0000ff02-0000-1000-8000-00805f9b34fb"); //xiaoxiang void setup() { Serial.begin(115200); BLEDevice::init(""); // Initialize BLE device + Serial.println("Scanning..."); } void loop() { BLEScan* pBLEScan = BLEDevice::getScan(); // Create new scan pBLEScan->setActiveScan(true); // Active scan uses more power, but get results faster - BLEScanResults foundDevices = pBLEScan->start(30); // Scan for 30 seconds + BLEScanResults foundDevices = pBLEScan->start(10); //seconds Serial.println("Scanning completed"); Serial.println("Devices found: " + String(foundDevices.getCount())); @@ -87,19 +88,20 @@ void loop() { } Serial.println(" - TX is writable"); - // REQUEST BASIC INFO - // header status command length data checksum footer - // DD A5 03 00 FF FD 77 - uint8_t a_data[7] = {0xdd, 0xa5, 3, 0x0, 0xff, 0xfd, 0x77}; - pRemoteCharacteristic_tx->writeValue(a_data, sizeof(a_data), false); - - // REQUEST CELL INFO - // header status command length data checksum footer - // DD A5 03 00 FF FD 77 - uint8_t b_data[7] = {0xdd, 0xa5, 4, 0x0, 0xff, 0xfc, 0x77}; - pRemoteCharacteristic_tx->writeValue(b_data, sizeof(b_data), false); - while(1){ + // REQUEST BASIC INFO + // header status command length data checksum footer + // DD A5 03 00 FF FD 77 + delay(500); + uint8_t a_data[7] = {0xdd, 0xa5, 3, 0x0, 0xff, 0xfd, 0x77}; + pRemoteCharacteristic_tx->writeValue(a_data, sizeof(a_data), false); + + // REQUEST CELL INFO + // header status command length data checksum footer + // DD A5 03 00 FF FD 77 + delay(500); + uint8_t b_data[7] = {0xdd, 0xa5, 4, 0x0, 0xff, 0xfc, 0x77}; + pRemoteCharacteristic_tx->writeValue(b_data, sizeof(b_data), false); } } }