Go Down

Topic: Arduino Controller Pro profiles and sketches (Read 4 times) previous topic - next topic

BobbyD

here is the last part of the " Home_Control " sketch:
Code: [Select]

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;
}


BobbyD

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

redcell

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....

BobbyD

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

Go Up