Add multiple lighting zones.
This commit is contained in:
parent
173c388b67
commit
f1dabd3a7d
2 changed files with 26 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue