Bonjour,
J'utilise actuellement ce programme (qui fonctionne à merveille).
#Include <SoftwareSerial.h>
SoftwareSerial SIM900(8,7);
void setup()
{
SIM900.begin(19200);
SIM900power();
delay(20000); // give time to log on to network.
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}
void sendSMS()
{
SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(100);
SIM900.println("AT + CMGS = \"numéro de téléphone utilisé\""); // recipient's mobile number, in international format
delay(100);
SIM900.println("Mon message"); // message to send
delay(100);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(100);
SIM900.println();
delay(5000); // give module time to send SMS
SIM900power(); // turn off module
}
void loop()
{
sendSMS();
do {} while (1);
}
J'aimerai cependant que ce soit moi qui ouvre le moniteur série pour que je tape moi même mes commandes AT..
J'ai donc tenté ceci:
#include <SoftwareSerial.h>
//
SoftwareSerial BTSerial(8, 7); // RX | TX
// RX arduino <--- TX cible
// TX arduino ---> RX cible
void setup(){
pinMode(9,OUTPUT);
digitalWrite(9,HIGH);
delay(3000);
digitalWrite(9,LOW);
Serial.begin(19200); // vitesse serial monitor
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
BTSerial.begin(19200); // vitesse software serial NB ne pas depasser 57600
}
void loop()
{
if (BTSerial.available()) Serial.write(BTSerial.read());
if (Serial.available()) BTSerial.write(Serial.read());
}
Cependant, il ne marche pas. J'ai ouvert le moniteur série, tenter quelques commandes mais rien ne se passe (même en testant la commande: AT).
Je m'y prends mal ?
(matériel utilisé: carte arduino uno + GPRS Shield Arduino Uno)