diff options
Diffstat (limited to 'Mussel/examples/vote')
-rw-r--r-- | Mussel/examples/vote/Mussel_Beacon_Voting.md | 20 | ||||
-rw-r--r-- | Mussel/examples/vote/vote.ino | 56 | ||||
-rw-r--r-- | Mussel/examples/vote/vote.puml | 27 |
3 files changed, 0 insertions, 103 deletions
diff --git a/Mussel/examples/vote/Mussel_Beacon_Voting.md b/Mussel/examples/vote/Mussel_Beacon_Voting.md deleted file mode 100644 index 33a0893..0000000 --- a/Mussel/examples/vote/Mussel_Beacon_Voting.md +++ /dev/null @@ -1,20 +0,0 @@ -## Mussel Beacon Voting - -1. Scans bluetooth network for beacons. - -2. Collects mussel name and gape angle -as decoded from each detected beacon, -together with the time of detection in milliseconds since boot. - -3. Aligns the collected data -to the format of ballots for a water quality vote. - -4. Qualifies the ballots for criteria of the water quality vote -(e.g. timeliness and sanity of gape angles). - -5. Concludes a vote based on collected, aligned and qualified ballots. - -6. Acts on the voting result, -e.g. turns on a steady light for "code green" -or a blinking light for "code yellow", -or turns on a blinking light and shuts off a valve for "code red". diff --git a/Mussel/examples/vote/vote.ino b/Mussel/examples/vote/vote.ino deleted file mode 100644 index ec9d185..0000000 --- a/Mussel/examples/vote/vote.ino +++ /dev/null @@ -1,56 +0,0 @@ -/* - Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp - Ported to Arduino ESP32 by Evandro Copercini - Changed to a beacon scanner to report iBeacon, EddystoneURL and EddystoneTLM beacons by beegee-tokyo - Upgraded Eddystone part by Tomas Pilny on Feb 20, 2023 -*/ - -#include <Arduino.h> - -#include <BLEDevice.h> -#include <BLEScan.h> -#include <BLEAdvertisedDevice.h> -#include <BLEEddystoneTLM.h> -#include <BLEBeacon.h> - -#include <Mussel.h> - -int scanTime = 1; //In seconds -BLEScan *pBLEScan; - -Mussel mussel(10); - -class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { - void onResult(BLEAdvertisedDevice advertisedDevice) { - if (advertisedDevice.haveName() - && advertisedDevice.getFrameType() == BLE_EDDYSTONE_TLM_FRAME - ) { - BLEEddystoneTLM EddystoneTLM(&advertisedDevice); - mussel.push( - advertisedDevice.getName(), - millis(), - EddystoneTLM.getTemp() - ); - } - } -}; - -void setup() { - Serial.begin(115200); - mussel.begin(); - - BLEDevice::init(""); - pBLEScan = BLEDevice::getScan(); //create new scan - pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); - pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster - pBLEScan->setInterval(100); - pBLEScan->setWindow(99); // less or equal setInterval value -} - -void loop() { - // put your main code here, to run repeatedly: - BLEScanResults *foundDevices = pBLEScan->start(scanTime, false); - pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory - mussel.printStack(); - delay(500); -} diff --git a/Mussel/examples/vote/vote.puml b/Mussel/examples/vote/vote.puml deleted file mode 100644 index a4958f7..0000000 --- a/Mussel/examples/vote/vote.puml +++ /dev/null @@ -1,27 +0,0 @@ -@startuml -:instantiate mussel object; -:instantiate bluetooth object; -group init -:setup mussel voting; -:setup bluetooth scanner; -end group -split -while (each beacon detected) -group "bluetooth callback" { -:collect beacon data; -end group -endwhile --[hidden]-> -kill -split again -while (each 500ms) -group loop { -:allign beacon data as ballots; -:qualify ballots for a vote; -:conclude vote result; -:act on vote result; -end group -endwhile --[hidden]-> -kill -@enduml |