Hello, how are you?
One of the parts of my application comes down to open an existing .txt file on the SD card, read your content, which refers to a cell number, and use that number read from the card file for a message to be sent to it .
With the example exist in the library can read smoothly the number on the SD card, and the library Linkit_AT you provided have also successfully send SMS and make calls, my problem is when I will write the value read from the SD card file, int celSD myFile.read = (); , In the phone number of the variable for messaging, LSMS.beginSMS (numCel); I made up all kinds of conversion using tools such as sprintf () and itoa () without success, I’m making a mistake in converting the variables and do not know what, I understand I read an int value and must convert to a char however, when I do this is shown only the last number of the cell and not the whole number, as if I was just reading the last byte of the array, can you help me?
Thank you!
This is the part of my code:
myFile = LSD.open(“celular.txt”);
if (myFile) {
Serial.println(“celular.txt aberto”);
myFile.seek(0);
// read from the file until there’s nothing else in it:
while (myFile.available()) {
// celSD = myFile.read();
Serial.write(myFile.read());
itoa(myFile.read(), numCel, 10);
// atoi(numCel, myFile.read(), 10);
// numCel.toCharArray(celSD, 20);
Serial.write(numCel);
// sprintf(numCel, “%c”, myFile.peek());
// Serial.write(myFile.read());
// Serial.write(numCel);
}
// close the file:
myFile.close();
} else {
// if the file didn’t open, print an error:
Serial.println(“error opening test.txt”);
}
Serial.println("SIM ready for work!");
LSMS.beginSMS(numCel);
// LSMS.print(text);
// LSMS.print(buff2);
LSMS.print(buff1);
if(LSMS.endSMS())
{
Serial.println(“SMS is sent”);
}
else
{
Serial.println(“SMS send fail”);
}