I'm trying to get the value from "char c;" and send it through sms which giving me a problem invalid conversion from 'char' to 'char*, i would like to put char c; to sms.SendSMS(number,c) // the this is the orginal sms.SendSMS(number,"you text").
#define ADMIN "92XXXXXXX"
char c;
if(strstr(message, "A")) //condition if it receive an "A" message from my phone
{
Wire.beginTransmission(5);
Wire.requestFrom(5,5); //"5" to communicate to other ard, "5" length of bytes
while(Wire.available())
{
c =Wire.read(); //reading the value, and display to Serial or LCD.
}
Serial.print(c); //from c=Wire.read(); i can get the value of what i need ex. 45670, and display to LCD and serial which is ok.
sprintf(buf,"%lu",c); //just my experimentation...... i know this code is wrong...
sms.SendSMS(number,c); // this is my problem, it won't compile and displaying invalid conversion from 'char' to 'char*' sms.SendSMS(number, "String code here") i know that this should be string but i'm at lost and confused.
delay(5000);
}
}
the sms.SendSMS(number,"your text"),
i would like to put like this sms.SendSMS(number,c) the char c holds the value ex. 34526 and then send. but im getting error.
thank you for the reply, yes as what i've read char can hold only one.
but in this code, it can display to LCD a "12345" or 23455 depending on the random generate number from the SLAVE (I2C) and it will stand as a password, send back to me in order for me to know. sorry for the bad logic.
when i send a message "A" the arduino will response to my message and send back a "Random number composing of 5 bytes" which will be my password.
while(Wire.available())
{
c =Wire.read(); //it can display the whole value at LCD and SERIAL MONITOR that generated from the other arduino(Slave) ex.42345.
}
How can i store the whole value that the char c get and send it, sms.SendSMS(number,c);
like value = c; then sms.SendSMS(number,value);
im really sorry for the bad description. im not really good in coding logic and still not really familiar with C, just trying my best to accomplish my project..
but in this code, it can display to LCD a "12345" or 23455
No, it can not. The sooner you understand that, the sooner you can make progress.
You may be able to receive, and send to the LCD, several different values, storing them ONE AT A TIME in c. You can NOT use a char to hold multiple characters.
If you get your program source code to compile, use the format option (Ctrl-T) in the IDE to reformat your code before you post it. That will make it easier for us to read your code.
You constantly add to the end of "myBigArray". I wouldn't use strcat, but sprintf. If you insist on using strcat, then you have to "reset" the array after printing
You don't reset strcat, but your char array, so the next time you write to it, it's empty
strcat(myBigArray, numbers);
strcat(myBigArray, str);
Serial.print(myBigArray);
sms.SendSMS(number,myBigArray);
myBigArray[0] = '\0'; // reset array for next time