Voila j'ai essayé d'enregistrer sur la carte SD mais ca ne marche pas
#include <SoftwareSerial.h>
#include <SD.h>
File myFile;
const int chipSelect = 10;
SoftwareSerial gprsSerial(7, 8);
void setup()
{
gprsSerial.begin(19200);
Serial.begin(19200);
//fonction SIM900power
SIM900power();
Serial.println("Config SIM900 en cours");
//delai de 20s secondes
delay(20000);
pinMode(10, OUTPUT);
if (!SD.begin(chipSelect)) {
Serial.println("Echec initialisation ou carte inexistant");
// don't do anything more:
return;
}
Serial.println("Initialisation SD reussie !");
Serial.println("Done!...");
gprsSerial.flush();
Serial.flush();
//Création du fichier
myFile = SD.open("test.txt", FILE_WRITE);
// attach or detach from GPRS service
gprsSerial.println("AT+CGATT?");
delay(100);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
delay(2000);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=3,1,\"APN\",\"wapsfr\"");
delay(2000);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=1,1");
delay(2000);
toSerial();
}
////////////////LOOP/////////////////////
void loop()
{
// initialize http service
gprsSerial.println("AT+HTTPINIT");
delay(2000);
toSerial();
//lien vers le fichier txt
gprsSerial.println("AT+HTTPPARA=\"URL\",\"http://forefire.univ-corse.fr/repondeur.txt\"");
delay(2000);
toSerial();
// set http action type 0 = GET, 1 = POST, 2 = HEAD
gprsSerial.println("AT+HTTPACTION=0");
delay(6000);
toSerial();
// read server response
gprsSerial.println("AT+HTTPREAD");
delay(1000);
toSerial2();
gprsSerial.println("");
gprsSerial.println("AT+HTTPTERM");
toSerial();
delay(300);
gprsSerial.println("");
delay(10000);
}
//focntion pour allumer la carte gsm
void SIM900power()
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
void toSerial()
{
while(gprsSerial.available()!=0)
{
Serial.write(gprsSerial.read());
}
}
void toSerial2()
{
while(gprsSerial.available())
{
Serial.write(myFile.read());
}
}