diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-18 01:24:05 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-18 01:24:05 +0200 |
commit | 6ca4ff06867aa5d7354615c828bd83234d827ff2 (patch) | |
tree | 6a42f307f09e05491f8e1eb9bf157e13916dad8d /Mussel/examples/sensor | |
parent | ea3988c911b467cbabe38cb9c3e6d0013b53965d (diff) |
rop Mussel library; move Arduino sketches below Arduino/
Diffstat (limited to 'Mussel/examples/sensor')
-rw-r--r-- | Mussel/examples/sensor/Mussel_Sensor_Beacon.md | 7 | ||||
-rw-r--r-- | Mussel/examples/sensor/sensor.ino | 54 | ||||
-rw-r--r-- | Mussel/examples/sensor/sensor.puml | 26 |
3 files changed, 0 insertions, 87 deletions
diff --git a/Mussel/examples/sensor/Mussel_Sensor_Beacon.md b/Mussel/examples/sensor/Mussel_Sensor_Beacon.md deleted file mode 100644 index e252104..0000000 --- a/Mussel/examples/sensor/Mussel_Sensor_Beacon.md +++ /dev/null @@ -1,7 +0,0 @@ -## Mussel Sensor Beacon - -1. Reads sensors. - -2. Normalises sensor data as a gape angle in the range of 0°-90°. - -3. Broadcasts normalised sensor data as a beacon on a bluetooth network. diff --git a/Mussel/examples/sensor/sensor.ino b/Mussel/examples/sensor/sensor.ino deleted file mode 100644 index 77b443f..0000000 --- a/Mussel/examples/sensor/sensor.ino +++ /dev/null @@ -1,54 +0,0 @@ -/* - EddystoneTLM beacon by BeeGee based on https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_Eddystone_TLM_deepsleep/ESP32_Eddystone_TLM_deepsleep.ino - EddystoneTLM frame specification https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md -*/ - -#include "BLEDevice.h" -#include "BLEBeacon.h" -#include "BLEAdvertising.h" -#include "BLEEddystoneTLM.h" - -#include <Mussel.h> - -#define BEACON_POWER ESP_PWR_LVL_N12 - -// See the following for generating UUIDs: -// https://www.uuidgenerator.net/ -BLEAdvertising *pAdvertising; - -#define BEACON_UUID "8ec76ea3-6668-48da-9866-75be8bc86f4d" // UUID 1 128-Bit (may use linux tool uuidgen or random numbers via https://www.uuidgenerator.net/) - -Mussel mussel(2); - -// Check -// https://github.com/google/eddystone/blob/master/eddystone-tlm/tlm-plain.md -// and http://www.hugi.scene.org/online/coding/hugi%2015%20-%20cmtadfix.htm -// for the temperature value. It is a 8.8 fixed-point notation -void setBeacon() { - BLEEddystoneTLM EddystoneTLM; - EddystoneTLM.setTemp(mussel.read()); // 3000 = 30.00 ˚C - Serial.printf("Temperature is %.2f°C\n", EddystoneTLM.getTemp()); - - BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); - BLEAdvertisementData oScanResponseData = BLEAdvertisementData(); - oScanResponseData.setServiceData(BLEUUID((uint16_t)0xFEAA), String(EddystoneTLM.getData().c_str(), EddystoneTLM.getData().length())); - - oAdvertisementData.setName("ESP32 TLM Beacon"); - pAdvertising->setAdvertisementData(oAdvertisementData); - pAdvertising->setScanResponseData(oScanResponseData); -} - -void setup() { - Serial.begin(115200); - mussel.begin(); - BLEDevice::init("TLMBeacon"); - BLEDevice::setPower(BEACON_POWER); - pAdvertising = BLEDevice::getAdvertising(); - setBeacon(); - pAdvertising->start(); -} - -void loop() { - setBeacon(); - delay(500); -} diff --git a/Mussel/examples/sensor/sensor.puml b/Mussel/examples/sensor/sensor.puml deleted file mode 100644 index 3f033d1..0000000 --- a/Mussel/examples/sensor/sensor.puml +++ /dev/null @@ -1,26 +0,0 @@ -@startuml -'start -:instantiate mussel object; -:instantiate bluetooth object; -group init -:setup mussel sensors; -:setup bluetooth beacon; -end group -split -while (each 500ms) -group loop { -:read sensors; -:normalize sensor data -as a gape angle; -:add gape angle to beacon; -end group -endwhile --[hidden]-> -kill -split again -while (each 100ms) -:broadcast beacon; -endwhile --[hidden]-> -kill -@enduml |