aboutsummaryrefslogtreecommitdiff
path: root/Mussel/examples
diff options
context:
space:
mode:
Diffstat (limited to 'Mussel/examples')
-rw-r--r--Mussel/examples/button/button.ino20
-rw-r--r--Mussel/examples/button_states/button_states.ino20
-rw-r--r--Mussel/examples/command/command.ino19
-rw-r--r--Mussel/examples/minute/minute.ino20
-rw-r--r--Mussel/examples/seconds/seconds.ino19
-rw-r--r--Mussel/examples/seconds/seconds.puml15
-rw-r--r--Mussel/examples/sensor/Mussel_Sensor_Beacon.md7
-rw-r--r--Mussel/examples/sensor/sensor.ino54
-rw-r--r--Mussel/examples/sensor/sensor.puml26
-rw-r--r--Mussel/examples/temperature/temperature.ino21
-rw-r--r--Mussel/examples/vote/Mussel_Beacon_Voting.md20
-rw-r--r--Mussel/examples/vote/vote.ino56
-rw-r--r--Mussel/examples/vote/vote.puml27
-rw-r--r--Mussel/examples/voting/voting.ino23
-rw-r--r--Mussel/examples/voting/voting.puml15
15 files changed, 0 insertions, 362 deletions
diff --git a/Mussel/examples/button/button.ino b/Mussel/examples/button/button.ino
deleted file mode 100644
index 5efae46..0000000
--- a/Mussel/examples/button/button.ino
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <Mussel.h>
-
-// instantiate with attitude #4,
-// and pin 4 connected to a button
-Mussel mussel(4, 4);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
- Serial.printf("gap:%d\n",
- mussel.read());
-
- delay(1000);
-}
diff --git a/Mussel/examples/button_states/button_states.ino b/Mussel/examples/button_states/button_states.ino
deleted file mode 100644
index 1d91b41..0000000
--- a/Mussel/examples/button_states/button_states.ino
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <Mussel.h>
-
-// instantiate with attitude #5,
-// and pin 9 connected to a button
-Mussel mussel(5, 9);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
- Serial.printf("gap:%d\n",
- mussel.read());
-
- delay(1000);
-}
diff --git a/Mussel/examples/command/command.ino b/Mussel/examples/command/command.ino
deleted file mode 100644
index f359e00..0000000
--- a/Mussel/examples/command/command.ino
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <Mussel.h>
-
-// instantiate with attitude #6
-Mussel mussel(6);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
- Serial.printf("gap:%d\n",
- mussel.read());
-
- delay(1000);
-}
diff --git a/Mussel/examples/minute/minute.ino b/Mussel/examples/minute/minute.ino
deleted file mode 100644
index 4bf59ce..0000000
--- a/Mussel/examples/minute/minute.ino
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <Mussel.h>
-
-// instantiate with attitude #2,
-// and pin 4 connected to a button
-Mussel mussel(2, 4);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
- Serial.printf("gap:%d\n",
- mussel.read());
-
- delay(1000);
-}
diff --git a/Mussel/examples/seconds/seconds.ino b/Mussel/examples/seconds/seconds.ino
deleted file mode 100644
index 928537c..0000000
--- a/Mussel/examples/seconds/seconds.ino
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <Mussel.h>
-
-// instantiate with attitude #2
-Mussel mussel(2);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
- Serial.printf("gap:%d\n",
- mussel.read());
-
- delay(1000);
-}
diff --git a/Mussel/examples/seconds/seconds.puml b/Mussel/examples/seconds/seconds.puml
deleted file mode 100644
index 55746ff..0000000
--- a/Mussel/examples/seconds/seconds.puml
+++ /dev/null
@@ -1,15 +0,0 @@
-@startuml
-'start
-:instantiate object;
-group init
-:activate object;
-:fetch and print object description;
-end group
-while (each 1s)
-group loop {
-:fetch and print gape angle;
-end group
-endwhile
--[hidden]->
-kill
-@enduml
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
diff --git a/Mussel/examples/temperature/temperature.ino b/Mussel/examples/temperature/temperature.ino
deleted file mode 100644
index 6b4ca08..0000000
--- a/Mussel/examples/temperature/temperature.ino
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <DHT.h>
-#include <Mussel.h>
-
-// instantiate with attitude #3,
-// and PIN 15 connected to an external sensor of type DHT11
-Mussel mussel(3, 15, DHT11);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
- Serial.printf("gap:%d\n",
- mussel.read());
-
- delay(1000);
-}
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
diff --git a/Mussel/examples/voting/voting.ino b/Mussel/examples/voting/voting.ino
deleted file mode 100644
index db4364d..0000000
--- a/Mussel/examples/voting/voting.ino
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <Mussel.h>
-
-// instantiate for vote handling
-Mussel mussel(10);
-
-void setup() {
- Serial.begin(115200);
- mussel.begin();
-
- Serial.printf("\n\nDevice ready: %s\n",
- mussel.desc().c_str());
-}
-
-void loop() {
-
- // Inject sample data
- mussel.push("A1", millis(), random(90));
- mussel.push("B2", millis(), random(90));
- mussel.push("C3", millis(), random(90));
- mussel.printStack();
-
- delay(1000);
-}
diff --git a/Mussel/examples/voting/voting.puml b/Mussel/examples/voting/voting.puml
deleted file mode 100644
index 8460d90..0000000
--- a/Mussel/examples/voting/voting.puml
+++ /dev/null
@@ -1,15 +0,0 @@
-@startuml
-'start
-:instantiate object;
-group init
-:activate object;
-end group
-while (each ½s)
-group loop {
-:register 3 fake votes;
-:fetch and print voting tally;
-end group
-endwhile
--[hidden]->
-kill
-@enduml