Ligne 342 : |
Ligne 342 : |
| </font> | | </font> |
| | | |
− | == Examples == | + | == Exemples == |
| + | === Note préliminaire === |
| + | Les exemples ci-dessous partent du principe que la carte SIM utilisée ne nécessite pas de code PIN. |
| + | Si votre carte SIM nécessite l'utilisation d'un code PIN, vous pouvez utiliser la commande AT+CPIN. |
| + | |
| === Sending SMS: using Software UART === | | === Sending SMS: using Software UART === |
− | <syntaxhighlight lang="Arduino"> | + | </nowiki> |
− | | |
| #include <NewSoftSerial.h> | | #include <NewSoftSerial.h> |
| | | |
Ligne 352 : |
Ligne 355 : |
| void setup() | | void setup() |
| { | | { |
− | mySerial.begin(19200); //Default serial port setting for the GPRS modem is 19200bps 8-N-1 | + | mySerial.begin(19200); // Paramètres par défaut du port série du GPRS shield (19200bps 8-N-1) |
− | mySerial.print("\r"); | + | mySerial.print("\r"); // Envoyer un retour à la ligne <CR> |
− | delay(1000); //Wait for a second while the modem sends an "OK" | + | delay(1000); // Attendre une seconde que le modem retourne "OK" |
− | mySerial.print("AT+CMGF=1\r"); //Because we want to send the SMS in text mode | + | mySerial.print("AT+CMGF=1\r"); // Envoyer un SMS en mode texte |
| delay(1000); | | delay(1000); |
| | | |
− | //mySerial.print("AT+CSCA=\"+919032055002\"\r"); //Setting for the SMS Message center number, | + | //mySerial.print("AT+CSCA=\"+919032055002\"\r");// Configurer le centre de message SMS, |
− | //delay(1000); //uncomment only if required and replace with | + | //delay(1000); // Retirer les commentaire seulement si nécessaire et |
− | //the message center number obtained from | + | // remplacer le No avec celui obtenu auprès de votre |
− | //your GSM service provider. | + | // fournisseur de service mobile. |
− | //Note that when specifying a tring of characters | + | //Note: pour inclure un " dans une chaine de caractère |
− | // " is entered as \" | + | // il faut utiliser la notation \" |
| | | |
− | mySerial.print("AT+CMGS=\"+9184460xxxx\"\r"); //Start accepting the text for the message | + | mySerial.print("AT+CMGS=\"+9184460xxxx\"\r"); // Commencer un SMS à envoyer au numéro +91.... |
− | //to be sent to the number specified. | + | // l'encodage du texte suivra plus bas. |
− | //Replace this number with the target mobile number. | + | // Remplacer le No avec celui de votre destinataire. |
| delay(1000); | | delay(1000); |
− | mySerial.print("Hi from Geekonfire!\r"); //The text for the message | + | mySerial.print("Bienvenu chez MCHobby!\r"); // Le texte du message |
| delay(1000); | | delay(1000); |
− | mySerial.print(26,BYTE); //Equivalent to sending Ctrl+Z | + | mySerial.print(26,BYTE); // Equivalent du Ctrl+Z (fin de texte du SMS) |
| } | | } |
| | | |
| void loop() | | void loop() |
| { | | { |
− | //We just want to send the SMS only once, so there is nothing in this loop. | + | // Nous voulons seulement envoyer le SMS une seule fois, il n'y a donc rien dans la boucle loop(). |
− | //If we put the code for SMS here, it will be sent again and again and cost us a lot. | + | // Si nous mettons le code du SMS ici, alors il sera envoyer encore et encore (Oups! cela couterait cher). |
| } | | } |
− | </syntaxhighlight> | + | </nowiki> |
− | | |
− | === Making a call: using Software UART ===
| |
− | <syntaxhighlight lang="Arduino">
| |
| | | |
| + | === Faire un appel: en utilisant l'UART logiciel === |
| + | <nowiki> |
| #include <NewSoftSerial.h> | | #include <NewSoftSerial.h> |
| | | |
Ligne 390 : |
Ligne 392 : |
| void setup() | | void setup() |
| { | | { |
− | mySerial.begin(19200); // the GPRS baud rate | + | mySerial.begin(19200); // GPRS baud rate |
− | Serial.begin(19200); // the GPRS baud rate | + | Serial.begin(19200); // GPRS baud rate |
| delay(2000); | | delay(2000); |
− | mySerial.println("ATDxxxxxxxxx;"); // xxxxxxxxx is the number you want to dial. | + | mySerial.println("ATDxxxxxxxxx;"); // xxxxxxxxx est le numéro a appeler. |
| | | |
| if(mySerial.available()) | | if(mySerial.available()) |
Ligne 403 : |
Ligne 405 : |
| delay(10000); | | delay(10000); |
| | | |
− | mySerial.println("ATH"); //End the call. | + | mySerial.println("ATH"); // Fin d'appel. |
| if(mySerial.available()) | | if(mySerial.available()) |
| { | | { |
Ligne 412 : |
Ligne 414 : |
| void loop() | | void loop() |
| { | | { |
− | //Do nothing | + | // Ne rien faire |
| } | | } |
| | | |
− | </syntaxhighlight> | + | </nowiki> |
| | | |
− | === Using AT Commands to Control GPIO and PWM pins === | + | === Commandes AT pour contrôler les broches GPIO et PWM === |
| <font color="red"> | | <font color="red"> |
− | Note: GPIOs,PWMs and ADC of the SIM900 module are all 2V8 logic.
| + | Attention!!! les broches GPIOs,PWMs et ADC du module SIM900 utilisent toutes une logique en 2,8 volts. |
| </font> | | </font> |
− | <syntaxhighlight lang="Arduino">
| |
| | | |
| + | <nowiki> |
| #include <NewSoftSerial.h> | | #include <NewSoftSerial.h> |
| | | |
Ligne 429 : |
Ligne 431 : |
| void setup() | | void setup() |
| { | | { |
− | mySerial.begin(19200); // the GPRS baud rate | + | mySerial.begin(19200); // GPRS baud rate |
− | Serial.begin(19200); // the GPRS baud rate | + | Serial.begin(19200); // GPRS baud rate |
| delay(2000); | | delay(2000); |
| } | | } |
Ligne 436 : |
Ligne 438 : |
| void loop() | | void loop() |
| { | | { |
− | mySerial.println("AT+SPWM=1,63,100");// set PWM 1 PIN | + | mySerial.println("AT+SPWM=1,63,100");// assigner une valeur PWM à la sortie PWM 1 |
− | mySerial.println("AT+SPWM=2,63,50");// set PWM 2 PIN | + | mySerial.println("AT+SPWM=2,63,50"); // assigner une valeur PWM à la sortie PWM 2 |
| | | |
− | mySerial.println("AT+SGPIO=0,1,1,1");// set GPIO 1 PIN to 1 | + | mySerial.println("AT+SGPIO=0,1,1,1");// Assigner la valeur 1 à la broche GPIO 1 |
| mySerial.println("AT+SGPIO=0,12,1,1"); | | mySerial.println("AT+SGPIO=0,12,1,1"); |
| delay(1000); | | delay(1000); |
| | | |
− | mySerial.println("AT+SGPIO=0,1,1,0");// set GPIO 1 PIN to 0 | + | mySerial.println("AT+SGPIO=0,1,1,0");// Assigner la valeur 1 à la broche GPIO 1 |
| mySerial.println("AT+SGPIO=0,12,1,0"); | | mySerial.println("AT+SGPIO=0,12,1,0"); |
| delay(1000); | | delay(1000); |
| } | | } |
− | | + | </nowiki> |
− | </syntaxhighlight> | |
| | | |
| == Schematics == | | == Schematics == |