aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_mussel2.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/_mussel2.c b/_mussel2.c
index 42ae010..2867777 100644
--- a/_mussel2.c
+++ b/_mussel2.c
@@ -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 "Cycles of five good then one bad"
+#define SERVICE_UUID "32eed4b3-e233-4808-a120-c4cee1a8e0c5"
+#define BEACON_UUID "84b7f168-a742-49b7-bd15-dc808dddb672"
+#define BEACON_UUID_REV "87a3c0f9-695f-4c04-8195-3a89d6cd44f0"
+#define CHARACTERISTIC_UUID "738e7085-9717-4288-ab21-c59ff7c5dd96"
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 second-long cyclic counter 0-11
+ unsigned long currentTime = millis();
+ unsigned long totalSeconds = currentTime / 1000;
+ unsigned long currentSecond = totalSeconds % 12;
+
+ String msg = "good";
+ if (currentSecond >= 9)
+ msg = "bad";
+
+ Serial.printf("*** NOTIFY: %s ***\n", msg);
+ pCharacteristic->setValue(msg);
pCharacteristic->notify();
value++;
}