Update RGB-3D.ino
This commit is contained in:
@@ -29,278 +29,277 @@
|
|||||||
#define SN "RGB Led strip 3D"
|
#define SN "RGB Led strip 3D"
|
||||||
#define SV "v1"
|
#define SV "v1"
|
||||||
|
|
||||||
|
// Load mysensors library
|
||||||
|
#include <MySensor.h>
|
||||||
|
// Load Serial Peripheral Interface library
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
// Load mysensors library
|
// Arduino pin attached to MOSFET Gate pin
|
||||||
#include <MySensor.h>
|
#define RED_PIN 3
|
||||||
// Load Serial Peripheral Interface library
|
#define GREEN_PIN 5
|
||||||
#include <SPI.h>
|
#define BLUE_PIN 6
|
||||||
|
|
||||||
// Arduino pin attached to MOSFET Gate pin
|
MySensor gw;
|
||||||
#define RED_PIN 3
|
|
||||||
#define GREEN_PIN 5
|
|
||||||
#define BLUE_PIN 6
|
|
||||||
|
|
||||||
MySensor gw;
|
// Define message name and type to send sensor info
|
||||||
|
MyMessage RedStatus(RED_PIN, V_DIMMER);
|
||||||
|
MyMessage GreenStatus(GREEN_PIN, V_DIMMER);
|
||||||
|
MyMessage BlueStatus(BLUE_PIN, V_DIMMER);
|
||||||
|
MyMessage Status(1, V_DIMMER);
|
||||||
|
MyMessage rgbShowState(0, V_LIGHT);
|
||||||
|
|
||||||
// Define message name and type to send sensor info
|
// Serial.print translate sensor id to sensor name
|
||||||
MyMessage RedStatus(RED_PIN, V_DIMMER);
|
char color[][6] = {"","","","RED","","GREEN","BLUE"};
|
||||||
MyMessage GreenStatus(GREEN_PIN, V_DIMMER);
|
|
||||||
MyMessage BlueStatus(BLUE_PIN, V_DIMMER);
|
|
||||||
MyMessage Status(1, V_DIMMER);
|
|
||||||
MyMessage rgbShowState(0, V_LIGHT);
|
|
||||||
|
|
||||||
// Serial.print translate sensor id to sensor name
|
// Vars for rgbShow function
|
||||||
char color[][6] = {"","","","RED","","GREEN","BLUE"};
|
int redval = 0;
|
||||||
|
int greenval = 0;
|
||||||
|
int blueval = 0;
|
||||||
|
long time=0;
|
||||||
|
int isShow;
|
||||||
|
|
||||||
// Vars for rgbShow function
|
void setup()
|
||||||
int redval = 0;
|
{
|
||||||
int greenval = 0;
|
// Initializes the sensor node (Callback function for incoming messages, node id, is repeater)
|
||||||
int blueval = 0;
|
gw.begin(incomingMessage, 31, true);
|
||||||
long time=0;
|
|
||||||
int isShow;
|
|
||||||
|
|
||||||
void setup()
|
// Present sketch (name, version)
|
||||||
{
|
gw.sendSketchInfo(SN, SV);
|
||||||
// Initializes the sensor node (Callback function for incoming messages, node id, is repeater)
|
|
||||||
gw.begin(incomingMessage, 31, true);
|
|
||||||
|
|
||||||
// Present sketch (name, version)
|
// Register sensors (id, type, description, ack back)
|
||||||
gw.sendSketchInfo(SN, SV);
|
gw.present(RED_PIN, S_DIMMER, "present RED light", false);
|
||||||
|
gw.present(GREEN_PIN, S_DIMMER, "present GREEN light", false);
|
||||||
|
gw.present(BLUE_PIN, S_DIMMER, "present BLUE light", false);
|
||||||
|
gw.present(0, S_LIGHT, "present Show button", false);
|
||||||
|
|
||||||
// Register sensors (id, type, description, ack back)
|
// Define pin mode (pin number, type)
|
||||||
gw.present(RED_PIN, S_DIMMER, "present RED light", false);
|
pinMode(RED_PIN, OUTPUT);
|
||||||
gw.present(GREEN_PIN, S_DIMMER, "present GREEN light", false);
|
pinMode(GREEN_PIN, OUTPUT);
|
||||||
gw.present(BLUE_PIN, S_DIMMER, "present BLUE light", false);
|
pinMode(BLUE_PIN, OUTPUT);
|
||||||
gw.present(0, S_LIGHT, "present Show button", false);
|
|
||||||
|
|
||||||
// Define pin mode (pin number, type)
|
// Correct saved RGB value for first start
|
||||||
pinMode(RED_PIN, OUTPUT);
|
gw.saveState(RED_PIN, constrain(gw.loadState(RED_PIN), 0, 100));
|
||||||
pinMode(GREEN_PIN, OUTPUT);
|
gw.saveState(GREEN_PIN, constrain(gw.loadState(GREEN_PIN), 0, 100));
|
||||||
pinMode(BLUE_PIN, OUTPUT);
|
gw.saveState(BLUE_PIN, constrain(gw.loadState(BLUE_PIN), 0, 100));
|
||||||
|
|
||||||
// Correct saved RGB value for first start
|
// Get value from eeprom and write to output
|
||||||
gw.saveState(RED_PIN, constrain(gw.loadState(RED_PIN), 0, 100));
|
analogWrite(RED_PIN, 255 * gw.loadState(RED_PIN) / 100);
|
||||||
gw.saveState(GREEN_PIN, constrain(gw.loadState(GREEN_PIN), 0, 100));
|
analogWrite(GREEN_PIN, 255 * gw.loadState(GREEN_PIN) / 100);
|
||||||
gw.saveState(BLUE_PIN, constrain(gw.loadState(BLUE_PIN), 0, 100));
|
analogWrite(BLUE_PIN, 255 * gw.loadState(BLUE_PIN) / 100);
|
||||||
|
|
||||||
// Get value from eeprom and write to output
|
// Write some debug info
|
||||||
analogWrite(RED_PIN, 255 * gw.loadState(RED_PIN) / 100);
|
Serial.print("Load from eeprom RED: ");
|
||||||
analogWrite(GREEN_PIN, 255 * gw.loadState(GREEN_PIN) / 100);
|
Serial.print(gw.loadState(RED_PIN));
|
||||||
analogWrite(BLUE_PIN, 255 * gw.loadState(BLUE_PIN) / 100);
|
Serial.println("%");
|
||||||
|
Serial.print("Load from eeprom GREEN: ");
|
||||||
|
Serial.print(gw.loadState(GREEN_PIN));
|
||||||
|
Serial.println("%");
|
||||||
|
Serial.print("Load from eeprom BLUE: ");
|
||||||
|
Serial.print(gw.loadState(BLUE_PIN));
|
||||||
|
Serial.println("%");
|
||||||
|
|
||||||
// Write some debug info
|
// Send RGB value to controler (request ack back: true/false)
|
||||||
Serial.print("Load from eeprom RED: ");
|
Serial.println("Send eeprom value to controler");
|
||||||
Serial.print(gw.loadState(RED_PIN));
|
gw.send( RedStatus.set(gw.loadState(RED_PIN)), false );
|
||||||
Serial.println("%");
|
gw.send( GreenStatus.set(gw.loadState(GREEN_PIN)), false );
|
||||||
Serial.print("Load from eeprom GREEN: ");
|
gw.send( BlueStatus.set(gw.loadState(BLUE_PIN)), false );
|
||||||
Serial.print(gw.loadState(GREEN_PIN));
|
|
||||||
Serial.println("%");
|
|
||||||
Serial.print("Load from eeprom BLUE: ");
|
|
||||||
Serial.print(gw.loadState(BLUE_PIN));
|
|
||||||
Serial.println("%");
|
|
||||||
|
|
||||||
// Send RGB value to controler (request ack back: true/false)
|
// Correct RGB show state for first start and load it (set to 'On' at first start)
|
||||||
Serial.println("Send eeprom value to controler");
|
gw.saveState(0, constrain(gw.loadState(0), 0, 1));
|
||||||
gw.send( RedStatus.set(gw.loadState(RED_PIN)), false );
|
isShow=gw.loadState(0);
|
||||||
gw.send( GreenStatus.set(gw.loadState(GREEN_PIN)), false );
|
|
||||||
gw.send( BlueStatus.set(gw.loadState(BLUE_PIN)), false );
|
|
||||||
|
|
||||||
// Correct RGB show state for first start and load it (set to 'On' at first start)
|
// Send RGB show state to controler (request ack back: true/false)
|
||||||
gw.saveState(0, constrain(gw.loadState(0), 0, 1));
|
gw.send( rgbShowState.set(isShow), false);
|
||||||
isShow=gw.loadState(0);
|
|
||||||
|
|
||||||
// Send RGB show state to controler (request ack back: true/false)
|
if (isShow==1){Serial.println("RGB show running..."); }
|
||||||
gw.send( rgbShowState.set(isShow), false);
|
Serial.println("Ready to receive messages...");
|
||||||
|
}
|
||||||
|
|
||||||
if (isShow==1){ Serial.println("RGB show running..."); }
|
void loop()
|
||||||
Serial.println("Ready to receive messages...");
|
{
|
||||||
}
|
// Process incoming messages (like config and light state from controller)
|
||||||
|
gw.process();
|
||||||
|
|
||||||
void loop()
|
// Run RGB show if is set
|
||||||
{
|
if (isShow==1)
|
||||||
// Process incoming messages (like config and light state from controller)
|
{
|
||||||
gw.process();
|
rgbShow();
|
||||||
|
analogWrite(RED_PIN, redval);
|
||||||
// Run RGB show if is set
|
analogWrite(GREEN_PIN, greenval);
|
||||||
if (isShow==1)
|
analogWrite(BLUE_PIN, blueval);
|
||||||
{
|
}
|
||||||
rgbShow();
|
}
|
||||||
analogWrite(RED_PIN, redval);
|
|
||||||
analogWrite(GREEN_PIN, greenval);
|
|
||||||
analogWrite(BLUE_PIN, blueval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void incomingMessage(const MyMessage &message)
|
void incomingMessage(const MyMessage &message)
|
||||||
{
|
{
|
||||||
if (message.isAck())
|
if (message.isAck())
|
||||||
{
|
{
|
||||||
Serial.println("Got ack from gateway");
|
Serial.println("Got ack from gateway");
|
||||||
}
|
}
|
||||||
if (message.type == V_LIGHT)
|
if (message.type == V_LIGHT)
|
||||||
{
|
{
|
||||||
// Incoming on/off command sent from controller ("1" or "0")
|
// Incoming on/off command sent from controller ("1" or "0")
|
||||||
int lightState = message.getString()[0] == '1';
|
int lightState = message.getString()[0] == '1';
|
||||||
|
|
||||||
// if receive RGB Show On commands, start the show
|
// if receive RGB Show On commands, start the show
|
||||||
if (message.sensor==0 && lightState==1){ rgbShowOn(); }
|
if (message.sensor==0 && lightState==1){ rgbShowOn(); }
|
||||||
// if receive RGB Show Off commands, stop the show
|
// if receive RGB Show Off commands, stop the show
|
||||||
else if (message.sensor==0 && lightState==0){ rgbShowOff(); }
|
else if (message.sensor==0 && lightState==0){ rgbShowOff(); }
|
||||||
|
|
||||||
// if receive RGB switch On command
|
// if receive RGB switch On command
|
||||||
else if (lightState==1)
|
else if (lightState==1)
|
||||||
{
|
{
|
||||||
// Write some debug info
|
// Write some debug info
|
||||||
Serial.print("Incoming change for ");
|
Serial.print("Incoming change for ");
|
||||||
Serial.print(color[message.sensor]);
|
Serial.print(color[message.sensor]);
|
||||||
Serial.println(": On");
|
Serial.println(": On");
|
||||||
Serial.print("Load from eeprom: ");
|
Serial.print("Load from eeprom: ");
|
||||||
|
|
||||||
if ( gw.loadState(message.sensor) == 0)
|
if ( gw.loadState(message.sensor) == 0)
|
||||||
{
|
{
|
||||||
// Pick up last saved dimmer level from the eeprom
|
// Pick up last saved dimmer level from the eeprom
|
||||||
analogWrite(message.sensor, 255 * gw.loadState(10*message.sensor) / 100);
|
analogWrite(message.sensor, 255 * gw.loadState(10*message.sensor) / 100);
|
||||||
// Save loaded value to current
|
// Save loaded value to current
|
||||||
gw.saveState(message.sensor, gw.loadState(10*message.sensor));
|
gw.saveState(message.sensor, gw.loadState(10*message.sensor));
|
||||||
Serial.print(gw.loadState(10*message.sensor));
|
Serial.print(gw.loadState(10*message.sensor));
|
||||||
Serial.println("%");
|
Serial.println("%");
|
||||||
// Send value to controler
|
// Send value to controler
|
||||||
Serial.println("Send value to controler");
|
Serial.println("Send value to controler");
|
||||||
gw.send(Status.setSensor(message.sensor).set(gw.loadState(10*message.sensor)),false);
|
gw.send(Status.setSensor(message.sensor).set(gw.loadState(10*message.sensor)),false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Pick up last saved dimmer level from the eeprom
|
// Pick up last saved dimmer level from the eeprom
|
||||||
analogWrite(message.sensor, 255 * gw.loadState(message.sensor) / 100);
|
analogWrite(message.sensor, 255 * gw.loadState(message.sensor) / 100);
|
||||||
Serial.print(gw.loadState(message.sensor));
|
Serial.print(gw.loadState(message.sensor));
|
||||||
Serial.println("%");
|
Serial.println("%");
|
||||||
// Send value to controler
|
// Send value to controler
|
||||||
Serial.println("Send value to controler");
|
Serial.println("Send value to controler");
|
||||||
gw.send(Status.setSensor(message.sensor).set(gw.loadState(message.sensor)),false);
|
gw.send(Status.setSensor(message.sensor).set(gw.loadState(message.sensor)),false);
|
||||||
}
|
}
|
||||||
// Stop the show if it's running
|
// Stop the show if it's running
|
||||||
if (isShow==1){ rgbShowStop(message.sensor); }
|
if (isShow==1){ rgbShowStop(message.sensor); }
|
||||||
}
|
}
|
||||||
// if recieve switch Off command
|
// if recieve switch Off command
|
||||||
else if (lightState==0)
|
else if (lightState==0)
|
||||||
{
|
|
||||||
// Write output to 0 (Off)
|
|
||||||
analogWrite(message.sensor, 0);
|
|
||||||
// Save old value to eeprom if it'was not zero
|
|
||||||
if ( gw.loadState(message.sensor) != 0 )
|
|
||||||
{
|
|
||||||
gw.saveState(10*message.sensor, constrain(gw.loadState(message.sensor), 0, 100));
|
|
||||||
}
|
|
||||||
// Save new value to eeprom
|
|
||||||
gw.saveState(message.sensor, 0);
|
|
||||||
// Write some debug info
|
|
||||||
Serial.print("Incoming change for ");
|
|
||||||
Serial.print(color[message.sensor]);
|
|
||||||
Serial.print(": ");
|
|
||||||
Serial.println("Off");
|
|
||||||
Serial.print("Store old value: ");
|
|
||||||
Serial.print(gw.loadState(10*message.sensor));
|
|
||||||
Serial.println("%");
|
|
||||||
// Send value to controler
|
|
||||||
Serial.println("Send value to controler");
|
|
||||||
gw.send(Status.setSensor(message.sensor).set(gw.loadState(message.sensor)),false);
|
|
||||||
// Stop the show if it's running
|
|
||||||
if (isShow==1){ rgbShowStop(message.sensor); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (message.type == V_DIMMER)
|
|
||||||
{
|
|
||||||
uint8_t incomingDimmerStatus = message.getByte();
|
|
||||||
// limits range of sensor values to between 0 and 100
|
|
||||||
incomingDimmerStatus = constrain(incomingDimmerStatus, 0, 100);
|
|
||||||
// Change Dimmer level
|
|
||||||
analogWrite(message.sensor, 255 * incomingDimmerStatus / 100);
|
|
||||||
//Save value to eeprom
|
|
||||||
gw.saveState(message.sensor, incomingDimmerStatus);
|
|
||||||
// Write some debug info
|
|
||||||
Serial.print("Incoming change for ");
|
|
||||||
Serial.print(color[message.sensor]);
|
|
||||||
Serial.print(": ");
|
|
||||||
Serial.print(incomingDimmerStatus);
|
|
||||||
Serial.println("%");
|
|
||||||
// Send value to controler
|
|
||||||
Serial.println("Send value to controler");
|
|
||||||
gw.send(Status.setSensor(message.sensor).set(gw.loadState(message.sensor)),false);
|
|
||||||
// Stop the show if it's running
|
|
||||||
if (isShow==1){ rgbShowStop(message.sensor); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void rgbShow()
|
|
||||||
{
|
{
|
||||||
time = millis();
|
// Write output to 0 (Off)
|
||||||
redval = 128+250*cos(2*PI/300000*time);
|
analogWrite(message.sensor, 0);
|
||||||
greenval = 128+250*cos(2*PI/300000*time-222);
|
// Save old value to eeprom if it'was not zero
|
||||||
blueval = 128+250*cos(2*PI/300000*time-111);
|
if ( gw.loadState(message.sensor) != 0 )
|
||||||
// limits range of sensor values to between 0 and 255
|
{
|
||||||
redval = constrain(redval, 0, 255);
|
gw.saveState(10*message.sensor, constrain(gw.loadState(message.sensor), 0, 100));
|
||||||
greenval = constrain(greenval, 0, 255);
|
}
|
||||||
blueval = constrain(blueval, 0, 255);
|
// Save new value to eeprom
|
||||||
|
gw.saveState(message.sensor, 0);
|
||||||
|
// Write some debug info
|
||||||
|
Serial.print("Incoming change for ");
|
||||||
|
Serial.print(color[message.sensor]);
|
||||||
|
Serial.print(": ");
|
||||||
|
Serial.println("Off");
|
||||||
|
Serial.print("Store old value: ");
|
||||||
|
Serial.print(gw.loadState(10*message.sensor));
|
||||||
|
Serial.println("%");
|
||||||
|
// Send value to controler
|
||||||
|
Serial.println("Send value to controler");
|
||||||
|
gw.send(Status.setSensor(message.sensor).set(gw.loadState(message.sensor)),false);
|
||||||
|
// Stop the show if it's running
|
||||||
|
if (isShow==1){ rgbShowStop(message.sensor); }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void rgbShowOn()
|
else if (message.type == V_DIMMER)
|
||||||
{
|
{
|
||||||
// define show On
|
uint8_t incomingDimmerStatus = message.getByte();
|
||||||
isShow=1;
|
// limits range of sensor values to between 0 and 100
|
||||||
// Save state
|
incomingDimmerStatus = constrain(incomingDimmerStatus, 0, 100);
|
||||||
gw.saveState(0, 1);
|
// Change Dimmer level
|
||||||
// Write some debug info
|
analogWrite(message.sensor, 255 * incomingDimmerStatus / 100);
|
||||||
Serial.println("Show must go on");
|
//Save value to eeprom
|
||||||
}
|
gw.saveState(message.sensor, incomingDimmerStatus);
|
||||||
|
// Write some debug info
|
||||||
void rgbShowOff()
|
Serial.print("Incoming change for ");
|
||||||
{
|
Serial.print(color[message.sensor]);
|
||||||
// define show Off
|
Serial.print(": ");
|
||||||
isShow=0;
|
Serial.print(incomingDimmerStatus);
|
||||||
// Save state
|
Serial.println("%");
|
||||||
gw.saveState(0, 0);
|
// Send value to controler
|
||||||
// Save RGB value to eeprom
|
Serial.println("Send value to controler");
|
||||||
gw.saveState(RED_PIN, 100 * redval / 255);
|
gw.send(Status.setSensor(message.sensor).set(gw.loadState(message.sensor)),false);
|
||||||
gw.saveState(GREEN_PIN, 100 * greenval / 255);
|
// Stop the show if it's running
|
||||||
gw.saveState(BLUE_PIN, 100 * blueval / 255);
|
if (isShow==1){ rgbShowStop(message.sensor); }
|
||||||
// Write some debug info
|
|
||||||
Serial.println("Stop the show");
|
|
||||||
// Send actual RGB value and state to controler and request ack back (true/false)
|
|
||||||
Serial.println("Send eeprom value to controler");
|
|
||||||
gw.send( RedStatus.set(gw.loadState(RED_PIN)), false );
|
|
||||||
gw.send( GreenStatus.set(gw.loadState(GREEN_PIN)), false );
|
|
||||||
gw.send( BlueStatus.set(gw.loadState(BLUE_PIN)), false );
|
|
||||||
gw.send( rgbShowState.set(0), false);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void rgbShowStop(int sensor)
|
void rgbShow()
|
||||||
{
|
{
|
||||||
// define show Off
|
time = millis();
|
||||||
isShow=0;
|
redval = 128+250*cos(2*PI/300000*time);
|
||||||
// Save state
|
greenval = 128+250*cos(2*PI/300000*time-222);
|
||||||
gw.saveState(0, 0);
|
blueval = 128+250*cos(2*PI/300000*time-111);
|
||||||
// Write some debug info
|
// limits range of sensor values to between 0 and 255
|
||||||
Serial.println("Stop the show");
|
redval = constrain(redval, 0, 255);
|
||||||
// Send actual RGB value and state to controler and request ack back (true/false)
|
greenval = constrain(greenval, 0, 255);
|
||||||
Serial.println("Send eeprom value to controler");
|
blueval = constrain(blueval, 0, 255);
|
||||||
if (sensor != RED_PIN)
|
}
|
||||||
{
|
|
||||||
|
void rgbShowOn()
|
||||||
|
{
|
||||||
|
// define show On
|
||||||
|
isShow=1;
|
||||||
|
// Save state
|
||||||
|
gw.saveState(0, 1);
|
||||||
|
// Write some debug info
|
||||||
|
Serial.println("Show must go on");
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgbShowOff()
|
||||||
|
{
|
||||||
|
// define show Off
|
||||||
|
isShow=0;
|
||||||
|
// Save state
|
||||||
|
gw.saveState(0, 0);
|
||||||
|
// Save RGB value to eeprom
|
||||||
|
gw.saveState(RED_PIN, 100 * redval / 255);
|
||||||
|
gw.saveState(GREEN_PIN, 100 * greenval / 255);
|
||||||
|
gw.saveState(BLUE_PIN, 100 * blueval / 255);
|
||||||
|
// Write some debug info
|
||||||
|
Serial.println("Stop the show");
|
||||||
|
// Send actual RGB value and state to controler and request ack back (true/false)
|
||||||
|
Serial.println("Send eeprom value to controler");
|
||||||
|
gw.send( RedStatus.set(gw.loadState(RED_PIN)), false );
|
||||||
|
gw.send( GreenStatus.set(gw.loadState(GREEN_PIN)), false );
|
||||||
|
gw.send( BlueStatus.set(gw.loadState(BLUE_PIN)), false );
|
||||||
|
gw.send( rgbShowState.set(0), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgbShowStop(int sensor)
|
||||||
|
{
|
||||||
|
// define show Off
|
||||||
|
isShow=0;
|
||||||
|
// Save state
|
||||||
|
gw.saveState(0, 0);
|
||||||
|
// Write some debug info
|
||||||
|
Serial.println("Stop the show");
|
||||||
|
// Send actual RGB value and state to controler and request ack back (true/false)
|
||||||
|
Serial.println("Send eeprom value to controler");
|
||||||
|
if (sensor != RED_PIN)
|
||||||
|
{
|
||||||
gw.saveState(RED_PIN, 100 * redval / 255);
|
gw.saveState(RED_PIN, 100 * redval / 255);
|
||||||
gw.send( RedStatus.set(gw.loadState(RED_PIN)), false );
|
gw.send( RedStatus.set(gw.loadState(RED_PIN)), false );
|
||||||
}
|
}
|
||||||
if (sensor != GREEN_PIN)
|
if (sensor != GREEN_PIN)
|
||||||
{
|
{
|
||||||
gw.saveState(GREEN_PIN, 100 * greenval / 255);
|
gw.saveState(GREEN_PIN, 100 * greenval / 255);
|
||||||
gw.send( GreenStatus.set(gw.loadState(GREEN_PIN)), false );
|
gw.send( GreenStatus.set(gw.loadState(GREEN_PIN)), false );
|
||||||
}
|
}
|
||||||
if (sensor != BLUE_PIN)
|
if (sensor != BLUE_PIN)
|
||||||
{
|
{
|
||||||
gw.saveState(BLUE_PIN, 100 * blueval / 255);
|
gw.saveState(BLUE_PIN, 100 * blueval / 255);
|
||||||
gw.send( BlueStatus.set(gw.loadState(BLUE_PIN)), false );
|
gw.send( BlueStatus.set(gw.loadState(BLUE_PIN)), false );
|
||||||
}
|
|
||||||
gw.send( rgbShowState.set(0), false);
|
|
||||||
}
|
}
|
||||||
|
gw.send( rgbShowState.set(0), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user