Add multiple lighting zones.

This commit is contained in:
Robert Marshall 2021-07-30 10:07:23 +01:00
parent 173c388b67
commit f1dabd3a7d
2 changed files with 26 additions and 17 deletions

View file

@ -2,22 +2,27 @@
#include <BLEUtils.h>
class BluetoothLEDCallback : public BLECharacteristicCallbacks {
LED *_led;
LED *_seatingLeds, *_kitchenLeds;
void onWrite(BLECharacteristic *characteristic) {
std::string value = characteristic->getValue();
if (value.length() > 0) {
Serial.println(value.c_str());
if (value == "on")
_led->on();
else
_led->off();
if (value == "seating on")
_seatingLeds->on();
if (value == "kitchen on")
_kitchenLeds->on();
if (value == "seating off")
_seatingLeds->off();
if (value == "kitchen off")
_kitchenLeds->off();
}
}
public:
BluetoothLEDCallback(LED* led){
_led = led;
BluetoothLEDCallback(LED *seatingLeds, LED *kitchenLeds){
_seatingLeds = seatingLeds;
_kitchenLeds = kitchenLeds;
}
};