diff options
Diffstat (limited to '_mussel1.c')
-rw-r--r-- | _mussel1.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -18,11 +18,11 @@ #include <BLE2902.h> #include <BLEBeacon.h> -#define DEVICE_NAME "ESP32" -#define SERVICE_UUID "7A0247E7-8E88-409B-A959-AB5092DDB03E" -#define BEACON_UUID "2D7A9F0C-E0E8-4CC9-A71B-A21DB2D034A1" -#define BEACON_UUID_REV "A134D0B2-1DA2-1BA7-C94C-E8E00C9F7A2D" -#define CHARACTERISTIC_UUID "82258BAA-DF72-47E8-99BC-B73D7ECD08A5" +#define DEVICE_NAME "Current second is below 50" +#define SERVICE_UUID "f9fde96b-d917-4877-ba4f-0813e69410c1" +#define BEACON_UUID "80e972d1-066f-4235-b44c-b6b681e63bf2" +#define BEACON_UUID_REV "ee4dadbb-6c32-48d5-9622-1d2dcc520154" +#define CHARACTERISTIC_UUID "c093f2ae-a81f-4683-b324-7a19f0f5e363" BLEServer *pServer; BLECharacteristic *pCharacteristic; @@ -125,8 +125,18 @@ void setup() { void loop() { if (deviceConnected) { - Serial.printf("*** NOTIFY: %d ***\n", value); - pCharacteristic->setValue(&value, 1); + + // Get the current second (0-59) + unsigned long currentTime = millis(); + unsigned long totalSeconds = currentTime / 1000; + unsigned long currentSecond = totalSeconds % 60; + + String msg = "good"; + if (currentSecond >= 9) + msg = "bad"; + + Serial.printf("*** NOTIFY: %s ***\n", msg); + pCharacteristic->setValue(msg); pCharacteristic->notify(); value++; } |