Completing Lifx driver that uses Particle cloud; Particle phone app provides a nice...
[iotcloud.git] / version2 / src / RPi / LightsController.ino
index 9ffe162726f08d5ebc98745acd2e4835c014a79b..b47d15d2cf69daa30085192edbd214fda8333cd6 100644 (file)
@@ -8,34 +8,48 @@
 LifxLightBulb *llb1;
 LifxLightBulb *llb2;
 
+int led1 = D7;
+
 void setup()
 {
        // Bulb 1
-       string macAddress1 = "D073D5128E300000";
-       uint8_t devIPAddress1[] = { 192, 168, 1, 126 };
+       char macAddress1[8];
+       macAddress1[0] = 0xD0;
+       macAddress1[1] = 0x73;
+       macAddress1[2] = 0xD5;
+       macAddress1[3] = 0x12;
+       macAddress1[4] = 0x8E;
+       macAddress1[5] = 0x30;
+       macAddress1[6] = 0x00; 
+       macAddress1[7] = 0x00;
+       IPAddress devIPAddress1(192, 168, 1, 126);
+
        llb1 = new LifxLightBulb(devIPAddress1, macAddress1, 12345);
        llb1->init();
        
        // Bulb 2
-       string macAddress2 = "D073D50241DA0000";
-       uint8_t devIPAddress2[] = { 192, 168, 1, 232 };
+       char macAddress2[8];
+       macAddress2[0] = 0xD0;
+       macAddress2[1] = 0x73;
+       macAddress2[2] = 0xD5;
+       macAddress2[3] = 0x02;
+       macAddress2[4] = 0x41;
+       macAddress2[5] = 0xDA;
+       macAddress2[6] = 0x00; 
+       macAddress2[7] = 0x00;
+       IPAddress devIPAddress2(192, 168, 1, 232);
+
        llb2 = new LifxLightBulb(devIPAddress2, macAddress2, 12346);
        llb2->init();
-       
+
+       pinMode(led1, OUTPUT);
     Particle.function("lifx1",lifx1Toggle);
     Particle.function("lifx2",lifx2Toggle);
 }
 
 
-void loop()
-{
+void loop() {
     // Nothing to do here
-       for(int i=0; i < 3; i++) {
-               llb1->turnOff();
-               delay(1000);
-               llb1->turnOn();
-               delay(1000);
-       }
 }