how can I send a variable to println?

this is my method

void mensaje_sms()
{
int numero = 777777; // this is my variable
SIM900.print("AT+CMGF=1\r");
delay(100);
SIM900.println("AT+CMGS="591"numero""");
//IM900.println("AT+CMGS="59177777777""); //only in this way does it work
delay(100);
SIM900.println("SEND NUMERO VARIABLE RODO");
delay(100);
SIM900.println((char)26);
delay(100);
SIM900.println();
delay(5000);
Serial.println("SMS sent successfully");
}
how can I send a variable to println?

how can I send a variable to println?

char *aVariable = "Silly newbies";

Serial.println(aVariable);

That was a little harsh - we were all newbies at one time!

OP, try test your code by sending the print() to the serial,console, then you’ll see what’s going wrong.
The solution will involve either two separate print statements, or some formatted printing to embed ‘numero’ within your print call.

That was a little harsh - we were all newbies at one time!

Well, some of us were able to read the reference material.

numero is an int

What is the largest value that an int can hold ?

PaulS:
Well, some of us were able to read the reference material.

cant believe people are insecure enough to feel the need to talk down newcomers

it is good advice though so let me just rephrase, the reference manual has a lot of good information. if you're confused about how a certain command or whatever works, just read through. Really helps you learn the foundation for most of the programs youll be reading/making, which is arguably the most important thing you can know.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

This may help.

Thanks.. Tom... :slight_smile:

You first need to initialize the Serial with Serial.begin(9600) in the setup() function, where the number is the baud rate and must be match in the Serial monitor. then after the Serial is initialized you can use Serial.println("hello"); either in the setup or in the loop or any other function