Bonjour,
Voici mon programme qui envoie un SMS pour donner la température, maintenant j'ai besoin d'envoyer 3 SMS à trois numéro différents. les deux SMS passe mais le 3éme ne passe pas
#include <GSM.h>
#define PINNUMBER "1111"
#include <math.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // select the pins used on the LCD panel
int a;
float temperature;
float temperature1;
int B=3975; //B value of the thermistor
float resistance;
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;
GSM gsmAccess1; // include a 'true' parameter for debug enabled
GSM_SMS sms1;
// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
// char array of the message
char txtMsg1[200]="ZoneDANGEREUSE T= ";
char txtMsglOG[200]="ALERTE ENVOYE A ";
char txtMsg[200]="ZoneClimatisee T= ";
void setup()
{
// initialize serial communications
Serial.begin(115200);
a=analogRead(0);
resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor;
temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;//convert to temperature via datasheet ;
delay(1000);
Serial.print("Current temperature is ");
Serial.println(temperature);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("la temperature");
lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
// nothing to see here
//delay(1000);
lcd.print(temperature);
if(temperature < 30){
Serial.println("SMS Messages Sender");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
sendSMS();
}
else {Serial.println("ZONENormale");}
}
void loop()
{
// lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
// nothing to see here
//delay(1000);
// lcd.print(temperature);
//lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
// nothing to see here
//delay(1000);
//Serial.print("Current temperature is ");
//Serial.println(temperature);
//lcd.print(temperature);
a=analogRead(0);
resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor;
temperature1=1/(log(resistance/10000)/B+1/298.15)-273.15;//convert to temperature via datasheet ;
delay(1000);
Serial.print("Current temperature is ");
Serial.println(temperature1);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("la temperature");
// if (temperature1 > 30 ){
Serial.println("SMS Messages Sender");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess1.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
sendSMS1();
//}
lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
// nothing to see here
//delay(1000);
lcd.print(temperature1);
lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
// nothing to see here
delay(1000);
//Serial.print("Current temperature is ");
//Serial.println(temperature);
lcd.print(temperature1);
if(temperature > 10){
Serial.println("SMS Messages Sender");
// connection state
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess1.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
sendfichierLog();
delay(1000);}
while(1){
delay(1001);
//for(i=0;i<112;i++) {blueToothSerial.write(moveTelegram2,sizeof(moveTelegram2));}
// blueToothSerial.begin(38400);//57600
// blueToothSerial.flush();
//setupBlueToothConnection2();
delay(1000);
}
}
void sendSMS1(){
char remoteNumber[20]= "";
Serial.print("Message to mobile number: ");
Serial.println(remoteNumber);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg1);
// send the message
sms.beginSMS(remoteNumber);
sms.print(txtMsg1);
sms.print(temperature1);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
void sendfichierLog(){
char remoteNumber[20]= "";
Serial.print("Message to mobile number: ");
Serial.println(remoteNumber);
Serial.println("Fichier Log: ");
//Serial.println(remoteNumber1);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg1);
// Serial.println(txtMsglOG);
// send the message
sms.beginSMS(remoteNumber);
sms.print(txtMsglOG);
sms.print(txtMsg1);
sms.print(temperature1);
// sms.print("");
// sms.print(txtMsg1);
// sms.print(temperature1);
// sms.print(txtMsglOG);
// sms.print("");
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
void sendSMS(){
char remoteNumber[20]= "";
Serial.print("Message to mobile number: ");
Serial.println(remoteNumber);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
// send the message
sms.beginSMS(remoteNumber);
sms.print(txtMsg);
sms.print(temperature);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}