This commit is contained in:
James 2024-04-25 21:32:49 +01:00
parent c7602f0eb9
commit bd1e96a7bc

View File

@ -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);
}
}
}