[SOLVED] Help with "dynamic" statement with string and pin state


here code:
code: [select]

else if (txtmsg.compareto("status") == 0)
 {
    string statustxt = "";
    pinstate = digitalread(pin);
    if (pinstate == 1){
    sms.remotenumber(remotenumber, 10);
    sms.beginsms(remotenumber);
    sms.print(statustxt);
    sms.endsms();
    }
 }

i need complete code next (my pseudo code)
if txt message status next:
if pinstatus == 1
    sting is: relay 'pin' on
else
string is: relay 'pin' off
sms.remotenumber(remotenumber, 10);
    sms.beginsms(remotenumber);
    sms.print(string);
    sms.endsms();

my brain stuck, mean stuck @ how create 1 string 2 states.

quote
my brain stuck, mean stuck @ how create 1 string 2 states.

probably because isn't want do. want create string (or string) 1 of 2 different states.

code: [select]
char stg[32];
if(i == 27)
   strcpy(stg, "the value 27");
else
   strcpy(stg, "the value not 27");

 

random
                      indenting
         even in
      psuedo code
                    isn't
        good
               idea.


Arduino Forum > Using Arduino > Programming Questions > [SOLVED] Help with "dynamic" statement with string and pin state


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support