Regarding Particle.function

const int minUpper = 1.0;  //To enter the valid value
const int maxUpper = 80.0;
const int minLower = 1.0;  //To enter the valid value
const int maxLower = 50.0;
const int minRefresh = 1.0; //To enter the valid value
const int maxRefresh = 20.0;

int threshold(String command1,String command2,String command3)
{
    
    int val1 = command1.toInt();
    if(minUpper <= val1 && val1<= maxUpper)
    {
        upperlimit=val1;
        EEPROM.write(2003,upperlimit);
        return val1;
   }
   
   int val2 = command2.toInt();
     if(minLower <= val2 && val2<= maxLower)
      {
        lowerlimit=val2;
        EEPROM.write(2004,lowerlimit);
        return val2;
       }
  
   int val3 = command3.toInt();
   if (minRefresh <= val3 && val3 <= maxRefresh) 
    {
    refresh = val3;
    EEPROM.write(2005,refresh);
    return val3;  // return the new value and carry on with that
    }
  
  
} 

The above code defines Particle.function() .My question is Can we have a code like this where we can pass 3 arguments using one Particle.function(“upper,lower,duration”,threshold);
When I compiled this code I got an error saying that

“invalid conversion from ‘int ()(String, String, String)’ to 'int ()(String)’ [-fpermissive]”

How to overcome this issue?

Not the way you envision it, but the same can be achieved by sending one string, and then parsing out the pieces you need. Separate the commands by a pre-determined character, which you can use to identify the separate parts.

2 Likes