Arduino Controller Pro profiles and sketches

Now that it's possible for the Arduino controller android application to import and export profiles, I thought it would be nice to have a place where we can exchange the profiles and the sketches.
Please add a screenshot if possible. If you don't have a place to upload the files send them to marque.l@gmail.com and I'll post them here.

If you don't want to worry about other people controlling your project use the share function in the application to export the profile, it will remove the IP before sending it with you mail editor.
Or just open the acp file with notepad and remove your IP manually.

Lets kick off with example profile 2 which came with version 2.1.03 of the android application.

Download: Example 2.acp

Download: Arduino sketch

Hi this is a work in progress. this is running on a arduino mega 2560 using transistor driven relays currently there are 5 digital light outputs and temp monitoring with min max and avg for both inside and out. there is going to be a total of 8 PWM zero crossing triac outputs for light dimmers and fan speed control, 8 digital triac outputs, 5 high current digital triac outputs, central heat and air control based on the difference in the inside and outside temps, motion detectors to count occupants entering and exiting the bedroom to automatically control lights, automatic door bell with visual image using an external ccd camera system, rfid and cellphone controlled door locks as well as entertainment center control using ir leds, digital pots, and relays. there is some code that isn't used at the moment if things look confusing. i am open to any feed back or suggestions.

house.rtf (78.3 KB)

Home.acp (2.83 KB)

Hello Marque ,
I just purchased the Pro App and I am starting to integrate some of the code functions that I had used in the original app you wrote . This is a slow process ( albiet fun ) but I truely am enjoying the results .
How do I add in the button functions when they are not defined in the Android app ? I added the function names in the settings , but can't find where the string names are associated ?

The more I look at the values you have built in for the red , green and blue , the more I would like to use them to set levels for the 3 areas that I am controlling mood lighting now.

I hope to get some time this long weekend to devote to this amazing integration project !

Thanks for all you have done thus far ; Arduino is such agreat learning platform ...especially when combined with Android !
Bob Durk

Red and green sliders are now working nice . I am still working on the blue as it is outputting integer values.
Learning as I go !
Bob

Changed the mapping for the blue slider , added an analog.write and the bench light is working sweet !

I was able to get button 10 working by changing from:

char carray[2];
readString.toCharArray( carray,2,(Iq+1));
RecievedString = atoi(carray);

char carray[2];
readString.toCharArray( carray,3,(Iq+1));
RecievedString = atoi(carray);

The only buttons that I am still having issues with is 11 and 12 ??
-the GET /?11 HTTP/1.1 and GET /?12 HTTP/1.1 appear on the serial monitor
-all I see is the white line on the (content_main_top) and it should be returning the button names that I have programmed in the Arduino sketch to the Android ?

Just an aside , I did have all 12 buttons working in a sketch with the original free version ( not the Pro Free ) ...but when I updated the Free I wasn't able to get 10 - 12 working .

Bob

Here is what I found that was preventing button S11 and S12 from working :
In the code where:
if (x == 10)
{client.print (content_main_top);
client.println(S10);
Serial.println(S10);

my code was in here and it had a return nested in it that should not have been and prevented any other statements below it
from being executed...my bad

}

I can now start making more buttons and rewrite the functions properly . This has been a great weekend of learning !

Bob

Here is where I am at now:
-I built a 2nd test node in a project box with a 2nd Ethernet Shield and Uno
-I added LEDS for testing the light levels from the 3 sliders on the tablet using Red=D5 Green=D6 Blue=D9
--Note that D10 and D11 can't be used as PWM as the Ethernet Shield requires them
--D3 I have used for IR ( to control stereo and CD player in my Node 1 " Home Control "
-I added 2 on board tactile switches D7 and D8 and set them as active LOW ( will be used to toggle lights on / off later)
-I also added a reset switch as the Ethernet shield is locking up ( or falling through ? ) with the code I am running
-I can use buttons for " Bench Lt Off " " Bench Lt On " " Curio Lt Off " " Curio Lt On " " All Off " " All On " no problem

Here is the issue ...I don't fully understand all that is going on in the test sketch for the sliders.
-I like the fact that the slider value is visible on the tablet , but I need to get the value to update when I change the value with the buttons or the corresponding slider.
-as it is now , if I turn lights on and off with the buttons for a while and then change the slider settings , eventually it will stop responding.
--the only way to get it working from that point is to reset the Ethernet Shield.

I will run the functions on the tablet for a while and see via the serial monitor where the problem occurs ...and if there is a common issue.

I will also post some of the code ( I am internet taught only , so don't expect much as i am still learning ! ) to see if it helps .

  • I tried to keep the functions for each button as simple as possible for testing

Bob

I shared the Work Bench profile with marque , as soon as I do a status update it locks up.
I will try to spend more time looking through code , but I think I am tripping up on the blue part ...I think it is just IB that I am supposed to be using to send for the blue slider.
I tried to attach code but it is too large ...I will send it later
Bob

BobbyD:
I shared the Work Bench profile with marque , as soon as I do a status update it locks up.
I will try to spend more time looking through code , but I think I am tripping up on the blue part ...I think it is just IB that I am supposed to be using to send for the blue slider.
I tried to attach code but it is too large ...I will send it later
Bob

Please send me your sketch so i can test it.

Here is the part of your profile wich controls the sliders

 <n7:seekbar_prefix_1 xmlns:n7="name">R</n7:seekbar_prefix_1>
  <n8:seekbar_prefix_2 xmlns:n8="name">Green=</n8:seekbar_prefix_2>
  <n9:seekbar_prefix_3 xmlns:n9="name">B</n9:seekbar_prefix_3>

In the arduino sketch it correspondents with;

else if (readString.indexOf("R") > 0){..............}
else if (readString.indexOf("Green=") > 0){..............}
else if (readString.indexOf("B") > 0){..............}

try to change it to:

 <n7:seekbar_prefix_1 xmlns:n7="name">Red=</n7:seekbar_prefix_1>
  <n8:seekbar_prefix_2 xmlns:n8="name">Green=</n8:seekbar_prefix_2>
  <n9:seekbar_prefix_3 xmlns:n9="name">Blue=</n9:seekbar_prefix_3>

And

else if (readString.indexOf("Red=") > 0){..............}
else if (readString.indexOf("Green=") > 0){..............}
else if (readString.indexOf("Blue=") > 0){..............}

Hello Marque,
I made the changes you suggested and I also removed parts of the code that I knew I would not need .
All the sliders now work and display the value stored.
Thanks for the help with that ....now to integrate the values and have the them diplayed when I select the " Update Status " button on the same layout. I had this in some other sketches but removed it to see if it was the cause of it locking up.
I would also like the slider to drop to " 0 " when I push the " Curio Off " " Bar Off " " Bench Off " or " All Off " buttons to reflect the changes .
Another nice thing would be to have the " Curio On " " Bar On " and " Bench On " buttons go green when the buttons are active.
I seen this in a sketch that was submitted for relay control ...perhaps I can incorporate that ...

How do I upload my Arduino sketch so you can look it over ?
Bob

Marque,
I went back to my profile #1 called Home Control and did the same changes for the slider names that you had suggested + removed some code that was not being used. It now operates without locking up and requiring a reset .
I shared this as well , as the IR functions work well and I am sure other can modify it to their needs .
Busy weekend ahead , but I will try to update as I make any changes.
Bob

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
    
 }

Here is part two of the " Home_Control " sketch:

void loop() 
{

  checkEthernetClient();

  // Do you stuff here like;
  // digitalWrite(channel, y);
  // analogWrite(ledPin, blue_value );

  //-------------------  Function working with X from Example layout 2 of the android app  --------------//
  nowtime = millis();                           // store the time
  if (abs(nowtime - lastTime) >= 100)           // if more than 100 milliseconds elapsed sinds last time (0.1 second)
  {
    if (string_x == "up") x++;                  // increase the value
    if (string_x == "stop") ;                   // stop increasing x
    if (string_x == "down") x = 0;              // reset value x to zero
    lastTime = nowtime;                         // store the time to compare next cycle
  }
  //-------------------  ****************************************************************  --------------//

}

void checkEthernetClient()
{
  EthernetClient client = server.available();          // check for module connection
  if (client)
  {
    boolean sentHeader = false;                        // header received
    boolean currentLineIsBlank = true;                 // a command is being received 
    while (client.connected())
    {        
      if (client.available())
      {
        if(!sentHeader){
          client.println("HTTP/1.1 200 OK");           // appears on android app
          client.println("Content-Type: text/html");   // eg. 
          client.println();                            // 
          sentHeader = true;                           //
          readString="";                               // 
          Serial.println();                            // command appears on serial monitor 
        }
        char c = client.read();
         //if (DEBUG5) Serial.write(c);                // bob uncommented to see what debug is printed / needs to be defined  
        if(readString.indexOf('\n') < 1)
        {
          readString.concat(c);                        //  
        }
        if (c == '\n' && currentLineIsBlank) {
          //Serial.print(readString);
          if (readString.indexOf("GET") >= 0){
            Serial.print(readString);                  //

            Serial.println();
            int Is = readString.indexOf("/");          //
            int Iq = readString.indexOf("?");          //
            int Ic = readString.indexOf("c");          //
            int Ib = readString.indexOf("b");          //
            int IR = readString.indexOf("R");          //
            int IG = readString.indexOf("G");          //
            int IB = readString.indexOf("B");          //
            if(readString.indexOf("?") > 1)
            { 

              /************************* Example 2 **************************/
              // All functions have diferent methods to get the value from the recieved string. 
              // Choose which one suits your needs 

              if (readString.indexOf("Blue=") > 0)                      // blue seekbar send value on every change while sliding over it
              {
                char carray[5];                                                // build an array to store the string containing the value
                readString.toCharArray( carray,5,(readString.indexOf("=")+1)); // read the string after $ and store it in the array
                valueblue = atoi(carray);                                     // convert the Array TO Int 
                valueblue =map( atoi(carray),0,255,0,255);  
                Serial.print("BenchLight is now: ");                           // print this on serial monitor 
                Serial.println(valueblue);                                    // print the integer value to serial
                analogWrite(benchLight, valueblue);                             //  Bob added to get bar light to dim OCT 12,2013
                client.print (content_main_top);                               // set the background an text color of the webview in the app
                client.print("BenchLight is now: ");                           // print this on header of android app 
                client.print(valueblue);                                      // print the integer value to the android application header 
              }
              else if (readString.indexOf("Red=") > 0)                     // CURIO LIGHT now working Oct 24,2013 
              {
                char carray[5];
                readString.toCharArray( carray,5,(readString.indexOf("=")+1)); // not being used at this time
                valuered = atoi(carray);                                   //
                valuered =map( atoi(carray),0,255,0,255);  
                Serial.print("CurioLight is now: ");                       //
                Serial.println(valuered);                                      //
                analogWrite(curioLight, valuered);
                client.print (content_main_top);                               //
                client.print("CurioLight is now: ");                       //
                client.print(valuered);                                        //
              }
              else if (readString.indexOf("Green=") > 0)                     // CURIO LIGHT now working Oct 24,2013 
              {
                char carray[5];
                readString.toCharArray( carray,5,(readString.indexOf("=")+1)); // not being used at this time
                valuegreen = atoi(carray);                                   //
                valuegreen =map( atoi(carray),0,255,0,255);  
                Serial.print("BarLight is now: ");                       //
                Serial.println(valuegreen);                                      //
                analogWrite(barLight, valuegreen);
                client.print (content_main_top);                               //
                client.print("BarLight is now: ");                       //
                client.print(valuegreen);                                        //
              }

Here is part three of the " Home_Control " sketch:

else if (readString.indexOf("value_x=") > 0)                     //
              {
                if (readString.indexOf("up") > 0){                             // UP button in app
                  string_x = "up";                                             // not used at this time
                }                                                              // in loop() x increases every second 
                if (readString.indexOf("stop") > 0){                           // STOP button in app
                  string_x = "stop";                                           // in loop() stop  increasing x
                }
                if (readString.indexOf("down") > 0){                           // Down button in app 
                  string_x = "reset";                                          //
                }                                                              // in loop() reset x to zero 

                Serial.print("x: ");                                           // serial monitor prints this 
                Serial.println(string_x);                                      // serial monitor fills in the value of the string_x 
                client.print (content_main_top);                               // app's turn to start printing value
                client.print("x: ");                                           // app prints X at header
                client.print(string_x);                                        // app prints the actual string value 
                ;//client.print("<meta http-equiv=refresh content=1,url=/?status_refresh>");  // webview in the android app refresh after 1 second and calls url ip:port/status_refresh
              }
              else if (readString.indexOf("status_refresh") > 0){              //
                Serial.print("x: ");                                           // print the X: into the serial monitor
                Serial.println(x);                                             // print this value into the serial monitor next to X:
                client.print (content_main_top);                               // app's turn to start printing value  
                client.print("x: ");                                           // print the value x to the android app 
                client.print(x);
                ;//client.print("<meta http-equiv=refresh content=1,url=/?status_refresh>"); // ask the app to refresh every second
              }
              else if (readString.indexOf("value_y") > 0)                      // read value from the first "$" to the second "$"
              {
                int first_S = readString.indexOf("$");                         //
                String string = readString.substring(first_S + 1,(readString.indexOf("$", first_S + 1))); 
                Serial.print(string);                                          //
                if(string == "+"){
                  y++;                                                         //
                }
                else if(string == "-"){
                  y--;                                                         //
                }
                else{
                  y = string.toInt();                                          //  
                }
                Serial.print("y: ");                                           // print on serial monitor
                Serial.println(y);                                             // print value of Y
                client.print (content_main_top);                               // print on app header 
                client.print("y: ");                                           // print the value of Y
                client.print(y);                                               // 
              }
              else if (readString.indexOf("value_z=") > 0)                     // read values seperated by ","
              {
                int comma;
                String string = readString.substring((readString.indexOf("=")+1),(comma = (readString.indexOf(","))));
                int a = string.toInt();
                string = readString.substring((comma + 1),(comma = (readString.indexOf(",", (comma + 1)))));
                int b = string.toInt();
                string = readString.substring((comma + 1),(comma = (readString.indexOf(",", (comma + 1)))));
                int c = string.toInt();
                Serial.print("a, b, c: ");
                Serial.print(a);
                Serial.print(b);
                Serial.println(c);
                client.print (content_main_top);
                client.print("a, b, c: ");
                client.print(a);
                client.print(b);
                client.print(c);
              }

              /************************* Example 1 **************************/

              else if (Ib == (Iq+1))
              {
                char carray[5];
                readString.toCharArray( carray,5,(Ib+1));
                Serial.println(carray);
                valueB = atof(carray);
                Serial.print("B is now: ");
                Serial.println(valueB);
                client.print (content_main_top);
                client.print("B is now: ");
                client.print(valueB);
              }
              else if (Ic == (Iq+1))
              {
                char carray[5];
                readString.toCharArray( carray,5,(Ic+1));
                Serial.println(carray);
                valueC = atof(carray);
                Serial.print("C is now: ");
                Serial.println(valueC);
                client.print (content_main_top);
                client.print("C is now: ");
                client.print(valueC);
              }
             
              else
              {
                char carray[2];                               // Bob changed to 3
                readString.toCharArray( carray,3,(Iq+1));     // change to 3 if 10th button added Bob Oct 14,2013
                RecievedString = atoi(carray);
                switch (RecievedString) {
                case 1: 
                  action(1, client);
                  break;
                case 2: 
                  action(2, client);
                  break;
                case 3: 
                  action(3, client);
                  break;
                case 4: 
                  action(4, client);
                  break;
                case 5: 
                  action(5, client);
                  break;
                case 6: 
                  action(6, client);
                  break;
                case 7: 
                  action(7, client);
                  break;
                case 8: 
                  action(8, client);
                  break;
                case 9: 
                  action(9, client);
                  break;
                case 10: 
                  action(10, client);
                  break;
                case 11:
                  action(11, client);
                  break;  
                case 20: 
                  action(20, client);
                  break;
                case 21: 
                  action(21, client);
                  break;
                case 22:
                  action(22, client);
                  break;  
                case 23: 
                  action(23, client);
                  break;
                case 24: 
                  action(24, client);
                  break;
                default: 
                  action(100, client);
                  break;  
                }
              }
              delay(1);                       // 
              client.stop();
              readString="";
              client.read(); 
              client.read();
            }
                  action(404, client);        //no "?" found so print a 404 error
          }
          delay(1);                           //  
          client.stop();
          readString="";
          client.read(); 
          client.read();
        }

here is the last part of the " Home_Control " sketch:

if (c == '\n') {
          currentLineIsBlank = true; 
        } 
        else if (c != '\r') { 
          currentLineIsBlank = false;
        }
      }
    }
    client.stop();
  }
}
void action(int x, EthernetClient client)
{  
  if (x == 01) 
  {client.print (content_main_top);
   client.println(S1);
   Serial.println(S1);
   irsend.sendNEC(0xC1A28877,32); // NEC Sherwood Receiver Power ON 
  }
if (x == 02) 
  {client.print (content_main_top);
   client.println(S2);
   Serial.println(S2);
   irsend.sendNEC(0xC1A2B847,32); // NEC Power OFF 
  }
if (x == 03) 
  {client.print (content_main_top);
   client.println(S3);
   Serial.println(S3);
   irsend.sendNEC(0xC1A2C03F,32); // NEC FM  
  }
if (x == 04) 
  {client.print (content_main_top);
   client.println(S4);
   Serial.println(S4);
   irsend.sendNEC(0x45BA38C7,32); // NEC CD POWER toggle
  }  
if (x == 05) 
  {client.print (content_main_top);
   client.println(S5);
   Serial.println(S5);
   irsend.sendNEC(0xC1A2D02F,32); // NEC cd player 
  }
if (x == 06) 
  {client.print (content_main_top);
   client.println(S6);
   Serial.println(S6);
   irsend.sendNEC(0x45BA52AD,32); // NEC Random 
  }
if (x == 07) 
  {client.print (content_main_top);
   client.println(S7);
   Serial.println(S7);
   irsend.sendNEC(0xC1A250AF,32); // NEC Ipod 
  }  
if (x == 8) 
  {client.print (content_main_top);
   client.println(S8);
   Serial.println(S8);
   valuegreen = 0;//
   analogWrite(barLight, valuegreen);                                //  Bob added to get bar light to dim OCT 12,2013
   client.print (content_main_top);                                  // set the background an text color of the webview in the app
   client.print("BarLight is now: ");
   client.print(valuegreen);                                         // print the value to the android application
  }
if (x == 9) 
  {client.print (content_main_top);
   client.println(S9);
   Serial.println(S9);
   valuegreen = 220;//
   analogWrite(barLight, valuegreen); 
   client.print (content_main_top);                                 // set the background an text color of the webview in the app
   client.print("BarLight is now: ");
   client.print(valuegreen);                                        // print the integer value to the android application
  } 
if (x == 10)
  {client.print (content_main_top);
   client.println(S10);
   Serial.println(S10);
   valuered = 0;                                                    // give a value of 0 so curioLight is off
   analogWrite(curioLight, valuered);                               // write redvalue of 0 to curioLight
   client.print (content_main_top);                                 // set the background an text color of the webview in the app
   client.print("CurioLight is now: ");
   client.print(valuered);                                          // print the value to the android application
   
  }

if (x == 11)
  {client.print (content_main_top);
   client.println(S11);
   Serial.println(S11);
   valuered = 160;
   analogWrite(curioLight, valuered);
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("CurioLight is now: ");
   client.print(valuered);                                        // print the value to the android application
  }  
    
if (x == 20) 
  {client.print (content_main_top);
   client.println(S20);
   Serial.println(S20);
   valueblue = 0;
   analogWrite(benchLight, valueblue);
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BenchLight is now: ");
   client.print(valueblue);                                       // print the value to the android application
  }
  
if (x == 21)
  {client.print (content_main_top);
   client.println(S21);
   Serial.println(S21);
   valueblue = 100;
   analogWrite(benchLight, valueblue);
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BenchLight is now: ");
   client.print(valueblue);                                       // print the value to the android application
  }    

if (x == 22) 
  {client.print (content_main_top);
   client.println(S22);
   Serial.println(S22);
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("CurioLight: ");
   client.print(valuered);                                        // print the integer value to the android application
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BarLight: ");
   client.print(valuegreen);          
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BenchLight: ");
   client.print(valueblue);  
    
  } 
  
if (x == 23) 
  {client.print (content_main_top);
   client.println(S23);
   Serial.println(S23);
   valuered = 0;
   analogWrite(curioLight, valuered);
   valuegreen = 0;
   analogWrite(barLight, valuegreen); 
   valueblue = 0;//
   analogWrite(benchLight, valueblue);                            //  Bob added to get bar light to dim OCT 12,2013
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("CurioLight: ");
   client.print(valuered);                                        // print the value to the android application
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BarLight: ");
   client.print(valuegreen);          
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BenchLight: ");
   client.print(valueblue);
      
    
  } 
  if (x == 24) 
  {client.print (content_main_top);
   client.println(S24);
   Serial.println(S24);
   valuered = 180;
   analogWrite(curioLight, valuered);
   valuegreen = 200;//
   analogWrite(barLight, valuegreen);
   valueblue = 100;
   analogWrite(benchLight, valueblue);
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("CurioLight: ");
   client.print(valuered);                                        // print the integer value to the android application
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BarLight: ");
   client.print(valuegreen);          
   client.print (content_main_top);                               // set the background an text color of the webview in the app
   client.print("BenchLight: ");
   client.print(valueblue);  
  } 

  if (x == 100)  //Default action
  {
    client.print (content_main_top);
    client.print ("Default message");
    Serial.println("Default");
  }
  if (x == 404) 
  {
    client.print (content_main_top);
    client.println(S404);
    Serial.println(S404);
  }
  x=0;
}

Here is the screenshot of the " Home_Control " as viewed on my Android tablet.Note the values for each light is shown at the top of the screen.
Bobby_D

Great app I bought it in the google play store..

is it possible to have more then the 32 available buttons?

I could use like 50 to 60 buttons to controll all of my devices at home.

On my Nexus 7 tablet there is plenty of room for more buttons then the available 32....

redcell ,
Hello again! Keep in mind you can have up to 8 profiles ...so over 200 buttons if you look at it that way. I have 3 separate ethernet boards and have 3 profiles . There is so much expandability as well with this app that you can have several profiles with the same IP and MAC address .It is then the string you send and decode with your Arduino program that provides you the extra button functionality.
I think Marque is doing some great work with his apps and he is helping to bring Arduino and Android to the people to use in some very creative ways .
BobbyD

If i use the script as mentioned i get an error:

avrdude: ser_open(): can't open device "/dev/cu.wchusbserial14220": No such file or directory

Is there also an example for beginners:
First a switc
Then an output

Because this is going fast.

Kind Regards,

Arjan