Here is the code that I am running for the " Home Control " profile.The " Status Update " button returns the light levels for each of the 3 lighting zones . The slider levels do not respond to the changes made with the switches , but the values displayed are updated with each button or slider adjustment.
/*********************** Marque's Arduino Controller Example ***********************/
/* Controller_Pro_Home_Control port all the values and use the status update button
/* Bob_Automation_Marque_v1 this now works without locking up ....tested and shut down many times with no issues command after command
/* renamed sliders as Marque suggested + removed functions that didn't appear to be required for this application
/* Eth_2 demo box made with reset switch orange tack button pulls to ground for reset + added D7 and D8 switches as active LOW ***future use
/* in box: Red-330 ohm to pin D5 + Grn-330 ohm to pin D6 + Blu-330 ohm to pin D9 ALL common cathode connect to ground
/* use Work Bench profile in Arduino Controller Pro app
/* now reports buffer values for the status update back to android app so they match the buffer content of valuered valuegreen and valueblue
/*********************** For questions: marque.l@gmail.com ***********************/
#include <Ethernet.h>
#include <SPI.h>
#include <IRremote.h>
int RecievedString; // this is sent from android app and received by Ethernet shield
int valuered; // couple with curioLight to make object
int valuegreen; // couple with BarLight to make object
int valueblue; // couple with BenchLight to make object
int valueB; // andoid app can send this string value ...arduino will need to recognise string to decode results
int valueC; // andoid app can send this string value ...arduino will need to recognise string to decode results
int Channel; // not used at this time
int Volume; // not used at this time
int x; //
int y; //
int Y; //
int Z; //
int blue_value ; // this is used in code now
int red_value; // added / not used now
int green_value; // added / not used now
String string_x; //
long nowtime; //
long lastTime; //
String readString = String(20); // string length up to 20 characters is read and stored in readString
byte mac[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // mac adress, change for every controller!
EthernetServer server(80); // port to listen on
IPAddress ip(192,168,1,100); // ip for fixed ip
EthernetClient client; // Ethernet Client to look for on the tcp port
char content_main_top[] = "<body bgcolor=black><font color=white><center>"; // html header to format the response webview. Black background and white text
char S1[] = "Power ON" ; //enter 01 as string 01
char S2[] = "Power OFF" ; //enter 02 as string 02
char S3[] = "FM Tuner"; //enter 03 as string 03
char S4[] = "CD Power Toggle"; //enter 04 as string 04
char S5[] = "CD Player"; //enter 05 as string 05
char S6[] = "CD Random"; //enter 06 as string 06
char S7[] = "IPod Player"; //enter 07 as string 07
char S8[] = "Bar Light Off"; //enter 08 as string 08
char S9[] = "Bar Light On"; //enter 09 as string 09
char S10[] = "Curio Lt Off"; //enter 10 as string 10
char S11[] = "Curio Lt On"; //enter 11 as string 11
char S20[] = "Bench Lt Off"; //enter 20 as string 20
char S21[] = "Bench Lt On"; //enter 21 as string 21
char S22[] = "Update Status"; //enter 22 as string 22
char S23[] = "All Off"; //enter 23 as string 23
char S24[] = "All On"; //enter 24 as string 24
char S404[] = "Not Found";
const int barLight = 6; // D6 use green slider green-value ( change to )
const int benchLight = 9; // D9 use blue slider blue_value
const int curioLight = 5; // D5 use red slider red_value ( change to )
int brightness = 0; // how bright the LED is
int fadeAmount = 10; // how many points to fade the LED by with each button push
int button2=0; // push button
int brightness2 = 0; // how bright LED2 is
int fadeAmount2 = 10; // how many points to fade LED2 by with each button push
// Variables will change:
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
;//IRrecv irrec(RECV_PIN); // no IR receiver in this design
IRsend irsend; // object to send the IR signal
decode_results results; // actual IR pulses or string
/************************** Setup **********************/
void setup()
{
Serial.begin(9600);
Serial.println("Getting IP......"); // serial monitor prints this 1st
//Ethernet.begin(mac); // select to use DHCP - comment out to use fixed ip
Ethernet.begin(mac,ip); // select to use fixed ip - comment out to use DHCP
server.begin(); // start the Arduino board
Serial.print("My IP address: "); // serial monitor prints this next
Ethernet.localIP().printTo(Serial); // reads IP from router
Serial.println(); // prints IP address on serial monitor
Serial.print("Gateway IP address is "); // serial monitor prints this next
Ethernet.gatewayIP().printTo(Serial); // reads gateway from router
Serial.println(); // prints gateway address on serial monitor
Serial.print("DNS IP address is "); // serial monitor prints this next
Ethernet.dnsServerIP().printTo(Serial); //reads DNS IP from router
Serial.println(); // prints DNS address on serial monitor
//irrec.enableIRin(); // IR input not used with this design
// initialize the LED as an output:
pinMode(barLight, OUTPUT); // pin D6 PWM controlled by green slider
digitalWrite(barLight, LOW); // start with pin 6 LOW
pinMode(benchLight, OUTPUT); // pin D9 PWM controlled by blue slider
digitalWrite(benchLight, LOW); // start with pin 9 LOW
pinMode(curioLight, OUTPUT); // pin D5 PWM controlled by red slider
digitalWrite(curioLight, LOW); // start with pin 5 LOW
pinMode(2, INPUT); // pin D2 is an input
digitalWrite(button2, LOW); // start with button 2 held LOW
}