Arduino Controller android app

djjoshuad:
Are there any plans to enable USB serial communication with an Arduino in this app?

No sorry, Just IP/TCP network

pisayjames:
finally.. i found the most important part of my project.. hehe thank you for this post.. uhmm marque can you post or share the codes from you android app? cause i want to see it.. i am really noob to making android app and i want to see hwo the code is constructed if you dont mind.. anyway thank you so much for this post.. i will try it tomorrow hehe

additional question.. uhmm can you tell me which part in your sketch the actions the arduino makes after recieving strings from the app? cause i want to insert ther actions like digitalwrite for my relays to turn on.. thank you

The first piece of code looks for the recieved string and send it to the second piece of code where the action takes place.
First piece of code:

 else
             {
               char carray[2];
               readString.toCharArray( carray,2,(Iq+1));
               RecievedString = atoi(carray);
               switch (RecievedString) {
               case 1: action(1, client);break;          //if found a "1" goto void action and preform action 1
               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;
               default: action(404, client);
               }

Second piece of code:

void action(int x, EthernetClient client)           //this is where the actions take place
{  
  if (x == 1)                                          //if found "1" this action takes place
  {client.print (content_main_top);     
   client.println(S1);                               //put your actions for button 1 here, like digitalwrite etc...
   Serial.println(S1);
  }
if (x == 2)                                          //if found "1" this action takes place
  {client.print (content_main_top);
   client.println(S2);                            //put your actions for button 2 here
   Serial.println(S2);
  }

pisayjames:
i downloaded the app sir..i downlaoded it on my samsung galaxy tab.. how will i go to settings screen? i dont see other button that goes to settings screen?

You can find the settings in the menu. You do not have a standard menu button as such. What you have is a softkey which can be found in different places depending on which android version you are in. This softkey takes the form of OPTIONS or SETTINGS which can be selected like a menu. IT looks like 3/4 horizontal bars.

I hope that answers your questions and I'm more than happy to help you out again anytime.

RB:
SUPERB!!

Thank you Marque!!!

This is just what I needed. I just started on my room-automation project today, so I'm sure I'll come up with some suggestions soon enough :slight_smile:

I tried rating the app, but unfortunately i don't have a Google+ account as yet -- will get around to that soon!

Thanks,
R

PS - Though I've made some changes and its working great, i have no clue what the following code does. Could you please explain it to me in just a brief overview sentence or two? Thanks!

 {readString.concat(c);}

if (c == 'H')
         {
           Serial.println();
           int Is = readString.indexOf("/");
           int Iq = readString.indexOf("?");
           int Ib = readString.indexOf("b");    //arduino looks for a b
           int Ic = readString.indexOf("c");    //arduino looks for a c
           if(readString.indexOf("?") > 1)
           {
             if (Ib == (Iq+1))                          // if there is a b
             {
               char carray[5];
               readString.toCharArray( carray,5,(Ib+1));    // read the value after the "b"
               Serial.println(carray);
                valueB = atof(carray);                              //set the found value to variable "valueB"
               Serial.print("B is now: ");
               Serial.println(valueB);                                  //print the found value
               client.print (content_main_top);
               client.print("B is now: ");
               client.print(valueB);
             }
            else if (Ic == (Iq+1))                                            // the same for "c"
             {
               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);
             }

in thise piece of code you can set two variable with you android app. In the settings screen you can set a prefix in the two textboxes top right. in the first one put a "b" and in the second one put a "c". on the main screen you can put a value in the two text views top left and hit the send button. the app will send a HTTP GET request in the following format: "http://yourip:yourport/?prefixvalue" , "http://192.168.1.120:80/?b2800". where the "b" is the prefix you have set in the settingsscreen and 2800 is the value you set in the main screen. The arduino sketch will look for a "b" or a "c" and sets the variable to the value that follows.
I have commented the code above, hope it clears it up for you.

@marque

uhmm i send you a personal message.. hope you can help me with it.. thank you so much... anyways if you have not received it, i was asking for your sketch/code in the android app.. because i want to modify some parts from it because my professor ask me for some changes in the app for my project study.. im still new with android programming but your app will be a good start for me to work with.. hope you can help me..

marque:
in thise piece of code you can set two variable with you android app.

Thanks for the explanation! The app works superbly!!! THANKS AGAIN :slight_smile:

I've set it to control a servo (which will be connected to a dimmer). I'm sharing the code below just in case anyone else wishes to control a servo with the app. The relays/switches part of the code below is still incomplete, but the servo part works perfectly. I've also applied the code change to allow 2-digit codes, so make sure they are all 01, 02, 03 in your android app settings.

Currently you have 2 buttons "dimmer down" (04) and "dimmer up" (14) that you can use to move the servo by a pre-defined angle. It also disconnects the servo after 1 second of no command, to avoid unnecessary current draw/vibrations, and also let it be freely moveable to allow manual control of the dimmer.

I've not changed anything in the checkClient() function.

Next, i'll be adding an IR control :slight_smile:

/************ Marque's Arduino Controller Example ************/
/***********  for questions: marque.l@gmail.com  ***********/
/*
http://arduino.cc/forum/index.php?topic=127770.0

In the android app settingsscreen you can set up you IP and port.
For this example you need to call prefix 1 "B" and prefix 2 "C".
*/
#include <Ethernet.h>
#include <HTTPClient.h>
#include <SPI.h>
#include <Servo.h> // servo library added

//MARQUESOFT's CODE
int RecievedString;
int valueB;
int valueC;
String readString = String(20); 

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x9A, 0x4D };
EthernetServer server(80);   // port to listen on
EthernetClient client;

char content_main_top[] = "<body bgcolor=black><font color=white><center>";
char S1[] = "Globe OFF" ;
char S2[] = "Couch Lights OFF" ;
char S3[] = "Loft Lights OFF";
char S4[] = "Dim Globe";
char S5[] = "05";
char S6[] = "06";
char S11[] = "Globe ON" ;
char S12[] = "Couch Lights ON" ;
char S13[] = "Loft Lights ON";
char S14[] = "Brighten Globe";
char S15[] = "15";
char S16[] = "16";
char S404[] = "Not Found";


//DIMMER SETUP
Servo dimmerServo;  // create a servo object 
int servoPin = 9;
int dimmerMax = 170; // the furthest the servo+dimmer goes anti-clockwise
int dimmerMin = 0; // the furthest the servo+dimmer goes clockwise
int dimmerIncrement = 10; // the step size for each button press
int dimmerVal = 0;
int dimmerValueShowPhone = dimmerMax - dimmerVal;
boolean detachServo = false; // note if the servo needs to be detached
long detachServoRequestTime = 0; //the millis at which detach servo was last requested

//RELAY SETUP



/************************** Setup **********************/
void setup() 
{
  Serial.begin(9600); 
  Serial.println("Getting IP......");
  Ethernet.begin(mac);
  Serial.print("My IP address: ");
  Ethernet.localIP().printTo(Serial);
  Serial.println();
  Serial.print("Gateway IP address is ");
  Ethernet.gatewayIP().printTo(Serial);
  Serial.println();
  Serial.print("DNS IP address is ");
  Ethernet.dnsServerIP().printTo(Serial);
  Serial.println();
}
void loop() 
{
  checkclient();

  if (detachServo == true) { detachServoAfterDelay(); }
}

void checkclient()
{
  EthernetClient client = server.available();
  if (client)   
  {
    boolean sentHeader = false;
    while (client.connected())
    {
      if (client.available())
      {
        if(!sentHeader){
        client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          sentHeader = true;
        }
         char c = client.read(); 
         if (readString.length() < 20) 
         Serial.print(c); //For debuggin in Serial Monitor window
         {readString.concat(c);}
         if (c == 'H')
         {
           Serial.println();
           int Is = readString.indexOf("/");
           int Iq = readString.indexOf("?");
           int Ib = readString.indexOf("b");
           int Ic = readString.indexOf("c");
           if(readString.indexOf("?") > 1)
           { 
             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];
               readString.toCharArray( carray,3,(Iq+1));
               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 11: action(11, client);break;
               case 12: action(12, client);break;
               case 13: action(13, client);break;
               case 14: action(14, client);break;
               case 15: action(15, client);break;
               case 16: action(16, client);break;               
               default: action(404, client);
               }
             }
          delay(1);
             client.stop();
             readString="";
             client.read(); client.read();
           }
         if (Iq < 0)
         {
         action(404, client);
         delay(1);
         client.stop();
         readString="";
         client.read(); client.read();
         }
          delay(1);
         client.stop();
         readString="";
         client.read(); client.read();
       }
     }
   }
 }
}

void action(int x, EthernetClient client)
{  
  if (x == 1) 
  {client.print (content_main_top);
   client.println(S1);
   Serial.println(S1);
  }
if (x == 2) 
  {client.print (content_main_top);
   client.println(S2);
   Serial.println(S2);
  }
if (x == 3) 
  {client.print (content_main_top);
   client.println(S3);
   Serial.println(S3);
  }
if (x == 4) // Dimmer Globe Down
  {client.print (content_main_top);
   client.println(S4);
   Serial.println(S4);
   dimmerDown();
   client.println(dimmerValueShowPhone);
  }
if (x == 5) 
  {client.print (content_main_top);
   client.println(S5);
   Serial.println(S5);
  }
if (x == 6) 
  {client.print (content_main_top);
   client.println(S6);
   Serial.println(S6);
  }
if (x == 11) 
  {client.print (content_main_top);
   client.println(S11);
   Serial.println(S11);
  }
if (x == 12) 
  {client.print (content_main_top);
   client.println(S12);
   Serial.println(S12);
  }
if (x == 13) 
  {client.print (content_main_top);
   client.println(S13);
   Serial.println(S13);
  }
if (x == 14) 
  {client.print (content_main_top);
   client.println(S14);
   Serial.println(S14);
   dimmerUp();
   client.println(dimmerValueShowPhone);   
  }
if (x == 15) 
  {client.print (content_main_top);
   client.println(S15);
   Serial.println(S15);
  }
if (x == 16) 
  {client.print (content_main_top);
   client.println(S16);
   Serial.println(S16);
  }
if (x == 404) 
  {client.print (content_main_top);
   client.println(S404);
   Serial.println(S404);
  }
  
x=0;
}


void dimmerUp() {
  if (detachServo == false) { dimmerServo.attach(servoPin); } // only re-attach if its already been detached
  dimmerVal = dimmerVal - dimmerIncrement;
  if (dimmerVal < dimmerMin) { dimmerVal = dimmerMin; } // making sure it doesnt cross the minimum
  dimmerServo.write(dimmerVal);
  delay(10);   // wait for the servo to get there 
  detachServo = true; // flags it to be detached after a few seconds
  detachServoRequestTime = millis();  
  dimmerValueShowPhone = dimmerMax - dimmerVal;  
}

void dimmerDown() {
  if (detachServo == false) { dimmerServo.attach(servoPin); } // only re-attach if its already been detached
  dimmerVal = dimmerVal + dimmerIncrement;
  if (dimmerVal > dimmerMax) { dimmerVal = dimmerMax; }  // making sure it doesnt cross the maximum
  dimmerServo.write(dimmerVal);
  delay(10);   // wait for the servo to get there 
  detachServo = true; // flags it to be detached after a few seconds
  detachServoRequestTime = millis();
  dimmerValueShowPhone = dimmerMax - dimmerVal;
}

void detachServoAfterDelay() {   // timed detach for servo after dimmer up or dimmer down to prevent heat / fatigue / vibrations for the servo
  unsigned long currentMillis = millis();  
  if ( (currentMillis - detachServoRequestTime) > 1000 ) //time has passed
  {
    dimmerServo.detach();
    detachServo = false;
  }
}

Hi Marque

Thanks for the app I have downloaded it and with your sketch I would like to intranet enable my heating system. I have my heating system running on Arduino Uno for 6 months now I have copied the sketch below.
What I would like to do is change some of the values in the program from your app, is this possible? I also want to be able to turn on the gas boiler form your app, which if I understand correctly is what your app could do now?

As you will see from my sketch my heating system is be-spoke!! I have two separate systems

  1. I have two heat sources which run into a tank called a Neutralizer I use the Arduino to control the heat dissipation via heating pump, under floor heating pump, and over temperature control.

  2. I use the Arduino to control the hot water system, a Honeywell valve and a contactor for my immersion heater

Both system used temperature sensors. The next stage is to add a circulating pump to pump hot water the top of the tankto the bottom of the tank. This is the last peice of code in the sketch but I haven't installed the pump or bottom cylinder sensor yet.

Do you think you can help???

Thanks in advance

Rich

//declare variables
int imm = 65;
int coil = 53;
int flow = 47;
int und = 62;
int mix = 57;
int hyst = 3;
int hyst1 =6;
int hyst2 =10;

float tempTop;
float tempMid;
float tempBot;
float tempFlow;
float tempRet;
float tempSol;

int tempPin = 0;
int tempPin1 = 1;
int tempPin2 = 2;
int tempPin3 = 3;
int tempPin4 = 4;

int NeutValve = 2; // Valve from neutralizer to Cylinder
int MPump = 3; // Mixer Pump
int HeatPump = 4; // Central Heating Main Pump
int ImmOn = 6; //Relay confirming Immersion running
int GasBoiler = 7; // Gas boiler run output
int UndFlor = 8; // Underfloor heating run output
int GasBurn = 9; // Gas Boiler run contact.
int Imm = 10; // Immersion Heater control
int FlorLiv = 11; // Underfloor Heating Living Room Output

void setup()

{
Serial.begin(9600); //opens serial port, sets data rate to 9600 bps
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, INPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,INPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
void loop()

{
Serial.println("");
tempTop = analogRead(tempPin); //read the value from the Cylinder Top sensor
tempTop = (5.0 * tempTop * 100.0)/1024.0+6; //convert the analog data to temperature
Serial.print((byte)tempTop);
Serial.println(" *C Cylinder Top");//send the data to the computer

tempMid = analogRead(tempPin1); //read the value from the sensor Cylinder Middle
tempMid = (5.0 * tempMid * 100.0)/1024.0+8; //convert the analog data to temperature
Serial.print((byte)tempMid);
Serial.println(" *C Cylinder Middle");//send the data to the computer

//tempBot = analogRead(tempPin2); //read the value from the sensor Cylinder Bottom
//tempBot = (5.0 * tempBot * 100.0)/1024.0; //convert the analog data to temperature
//Serial.print((byte)tempBot);
//Serial.println(" *C Cylinder Bottom");//send the data to the computer

tempFlow = analogRead(tempPin3); //read the value from the sensor Neutraziler Flow Temp
tempFlow = (5.0 * tempFlow * 100.0)/1024.0; //convert the analog data to temperature
Serial.print((byte)tempFlow);
Serial.println(" *C Flow Temp");//send the data to the computer

tempRet = analogRead(tempPin4); //read the value from the sensor Return Temp
tempRet = (5.0 * tempRet * 100.0)/1024.0; //convert the analog data to temperature
Serial.print((byte)tempRet);
Serial.println(" *C Return Temp");//send the data to the computer

int ImmOn1 = digitalRead (ImmOn);
Serial.print (" Immersion On ");
Serial.println(ImmOn1);

int Pump1 = digitalRead (HeatPump);
Serial.print (" Central Heating Pump On ");
Serial.println(Pump1);

int Pump2 = digitalRead (UndFlor);
Serial.print ("Underfloor Heating ON ");
Serial.println(Pump2);

int Coil1 = digitalRead (NeutValve);
Serial.print ("Water Heating Coil Reversed ");
Serial.println(Coil1);

if (Imm == HIGH) Serial.print ("IMM Contact ");
else Serial.println (" IMM No Contact ");

int Mix1 = digitalRead (MPump);
Serial.print ("mixer pump");
if (Mix1 == HIGH) Serial.print ("Mixing");
else Serial.print(" no mix");

delay(2000); //wait one second before sending new data
// Heating Circulating pump

if (tempRet > flow + hyst1)
digitalWrite(HeatPump, HIGH);

if (tempRet < flow - hyst1)
digitalWrite(HeatPump, LOW);

// Underfloor Heating Control
if (tempFlow > (und + hyst))
digitalWrite (UndFlor, HIGH);

if (tempFlow < (und - hyst2))
digitalWrite (UndFlor, LOW);

//Over Temperature Protection
if (tempFlow > 85)
digitalWrite (FlorLiv, HIGH);

if (tempFlow < 65)
digitalWrite (FlorLiv, LOW);

// Neutralizer Valve Control
if(tempTop >(coil + hyst)) // Neutralizer to Cylinder Valve Close Temperature
digitalWrite(NeutValve, HIGH);

if (tempTop <(coil - hyst)) // Neutralizer to Cylinder Open Temperature
digitalWrite(NeutValve, LOW);

// Immersion Control
if (tempTop >( imm + hyst)) // Immersion Temperature Off
digitalWrite(Imm,LOW );

else if (tempTop <( imm - hyst)) // Immersion on Temperature
digitalWrite(Imm, HIGH);

// Cylinder Circulating Pump Control

if (tempTop < (mix + hyst) && (ImmOn == HIGH))

digitalWrite (MPump, HIGH);

if (tempTop >(mix - hyst) || (ImmOn == LOW))

digitalWrite (MPump, LOW);

}

Hi Marque

Thanks for the excellent app very useful and easy to adapt to my needs.
Is it possible to make any login to access to the application for security reason (I like close and open a door, switch off on alarm, ..).
And is it possible in settings button for reset change to button for save configuration, because I use this app to access to different arduino board with different functionality.

thx

Thanks in advance

Lesz

HI Marque

Is it possible through the Arduino Sketch to alter the size of the window at the top of the page?

Or is it pre programmed in to the Android App?

Thanks

Rich

@ Alesz & RichieC,
Thanks for your input. Both functions need adjustments to sketch and application and will come back in future versions.

Hello Marque,

I am very happy that I found your project. I am working at my own project and have some problems. First I want to suggest my project.

I use an arduino mega to read out some sensors. The values I want to send to my android phone. I tried to use and adapt another project working with the same WifiShield(RedFly WifiShield) (you can find this project here: http://android-arduino-redfly.npage.de/) but there I got the problem that i only can send small values(0...255). For my project I need to send bigger values.

Because I am using the RedFly WifiShield to connect to the LAN I have to use other libraries in my sketch so that I can't copy your code. I tried to get your code working with my WifiShield but there are some problems I don't understand.
I attached my code named ARDUINO_CONTROLLER.ino because when I post it the post exceeds the maximum allowed length(9500 characters).

Errorlog:

ARDUINO_CONTROLLER:17: error: 'RedFlyServer' does not name a type
ARDUINO_CONTROLLER.ino: In function 'void checkclient()':
ARDUINO_CONTROLLER:78: error: 'server' was not declared in this scope
ARDUINO_CONTROLLER:86: error: 'sentheader' was not declared in this scope
ARDUINO_CONTROLLER:137: error: 'action' was not declared in this scope
ARDUINO_CONTROLLER:154: error: 'action' was not declared in this scope
ARDUINO_CONTROLLER.ino: In function 'void action(int, RedFlyClient ()())':
ARDUINO_CONTROLLER:176: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:177: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:182: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:183: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:188: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:189: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:194: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:195: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:200: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:201: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:206: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:207: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:212: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:213: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient (*)()'

I am sure that the follwing code is right because it works with the other project. This setup connects the Arduino Mega with RedFly Shield to my Wifi.

void setup()
{
uint8_t ret;
//init the WiFi module on the shield
ret = RedFly.init();
if(ret)
{
debugoutln("INIT ERR"); //there are problems with the communication between the Arduino and the RedFly
}
else
{
//scan for wireless networks (must be run before join command)
RedFly.scan();

//join network
//ret = RedFly.join("WLAN-SSID", "passwort123", INFRASTRUCTURE);
ret = RedFly.join("Connectify-arduinopc", "12345678", INFRASTRUCTURE);
if(ret)
{
debugoutln("JOIN ERR");
for(;;); //do nothing forevermore
}
else
{
//set ip config
ret = RedFly.begin(ip, 0, 0, netmask);
if(ret)
{
debugoutln("BEGIN ERR");
RedFly.disconnect();
for(;;); //do nothing forevermore
}
}
}
Serial.begin(9600); // open the serial connection at 9600bps
}

I attached the RedFly libraries. But I am sure these are the same like the normal HTTPClient library and so on. The only difference is that they are adapted to work with the RedFly Shield.

Can you help me to get your code working with my RedFly Wifi Shield?

Another option for me could be that you give me only the code I need for arduino to send something to an android phone and the code I need in the android-app to receive the data. If I understand your project right it's a normal HTTP request needed to send data. I can make HTTP Requests with my arduino and the RedFly Shield.
For Example the following code works with CouchDB.

         if(client.connect(server, 5984))
          {
            //make a HTTP request
            //client.print_P(PSTR("GET / HTTP/1.1\r\nHost: "HOSTNAME"\r\n\r\n"));
            
            //Delte Database
            //client.println_P(PSTR("DELETE /test2/ HTTP/1.0"));
            //client.println_P(PSTR("Content-Type: application/json\r\n"));
            
            //Create Database
            //client.println_P(PSTR("PUT /test9/ HTTP/1.0"));
            //client.println_P(PSTR("Content-Type: application/json\r\n"));
             
            //Put a document to the database              THIS DOESN'T WORK           
            /*client.println_P(PSTR("POST /test1/ HTTP/1.0"));
            client.println_P(PSTR("Content-Type: application/json\r\n"));
            client.println_P(PSTR("{"));
            client.println_P(PSTR("\"Subject\":\"I like Plankton\","));
            client.println_P(PSTR("\"Author\":\"Rusty\","));
            client.println_P(PSTR("\"PostedDate\":\"2006-08-15T17:30:12-04:00\","));
            client.println_P(PSTR("\"Tags\":[\"plankton\", \"baseball\", \"decisions\"],"));
            client.println_P(PSTR("\"Body\":\"I decided today that I don't like baseball. I like plankton.\""));
            client.println_P(PSTR("}"));
            */
          }

Thank you in advance!

RedFly.zip (16.6 KB)

ARDUINO_CONTROLLER.ino (5.55 KB)

RedFly.zip (16.6 KB)

hello Marque,

I worked a little bit with my adapted Sketch. I will attach the new Sketch to this post. The new Errorlog is this:

ARDUINO_CONTROLLER.ino: In function 'void checkclient()':
ARDUINO_CONTROLLER:141: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:142: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:143: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:144: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:145: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:146: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:147: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER:158: error: cannot convert 'RedFlyClient' to 'RedFlyClient ()()' for argument '2' to 'void action(int, RedFlyClient ()())'
ARDUINO_CONTROLLER.ino: In function 'void action(int, RedFlyClient ()())':
ARDUINO_CONTROLLER:180: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:181: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:186: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:187: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:192: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:193: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:198: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:199: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:204: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:205: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:210: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:211: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient ()()'
ARDUINO_CONTROLLER:216: error: request for member 'print' in 'client', which is of non-class type 'RedFlyClient (
)()'
ARDUINO_CONTROLLER:217: error: request for member 'println' in 'client', which is of non-class type 'RedFlyClient (*)()'

There is a new version of the arduino controller android app available in google play. This app will cost you a beer for my effort but it has a some new features and it will let you costumize it so it looks specialy disigned for your arduino project.

Changes made to this version:
-The size of the webview automaticaly ajusts to the content
-Improved use of resources and battery usage
-URL and IP support (eg. www.mysite.com or 143.34.175.45)
-Custom activity name (the name you see on the main screen of the app)
-More buttons (32!)
-Buttons are hidden when you dont use them
-Strings can contain all alpha numeric symbols

Arduino Controller Pro can be found in google play.
And the example sketch on dropbox.

Now there is a free version with ads as well.

Hi Marque

Thanks for the excellent update, very useful and easy to adapt to my needs.
Suggestion for next update:

  • login to access to the application for security reason (switch off on alarm, ..).
  • in settings - add button for save profile for save configuration (conf. A, conf B, ..(I use this app to access to different arduino board with different functionality: alarm, control heat pump, lights, ...)

thx

Lesz

Alesz:
Hi Marque

Thanks for the excellent update, very useful and easy to adapt to my needs.
Suggestion for next update:

  • login to access to the application for security reason (switch off on alarm, ..).
  • in settings - add button for save profile for save configuration (conf. A, conf B, ..(I use this app to access to different arduino board with different functionality: alarm, control heat pump, lights, ...)

thx

Lesz

Profiles willen be implemented in the next version, coming next week. Login feature is still on the drawingboard.

Hello Marque,
is it possible to control more than one Arduino with different IP-Adresses?
(Home Automation for different Rooms)

thx
Ruediger

ruediger64:
Hello Marque,
is it possible to control more than one Arduino with different IP-Adresses?
(Home Automation for different Rooms)

thx
Ruediger

Hi, In the next version there is support for three profiles with diferent ip adresses. I hope to finish it next week.

marque:
Now there is a free version with ads as well.

On rooted phones it is already possible to back up your settings by backing up the XML file in data/data/com.marquesoft.arduinocontroller/shared_prefs