|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #1 on: May 02, 2012, 07:38:14 am » |
jai voulu tester de m envoyer un sms jai trouvé un code tout fait int led = 13; int onModulePin = 2; // the pin to switch on the module (without press on button)
int timesToSend = 1; // Numbers of SMS to send int count = 0;
void switchModule(){ digitalWrite(onModulePin,HIGH); delay(2000); digitalWrite(onModulePin,LOW); }
void setup(){
pinMode(led, OUTPUT); pinMode(onModulePin, OUTPUT);
Serial.begin(19200); // the GPRS baud rate switchModule(); // swith the module ON for (int i=0;i<2;i++){ delay(5000); } Serial.println("AT+CMGF=1"); // set the SMS mode to text }
void loop(){ while (count < timesToSend){ delay(1500); Serial.print("AT+CMGS="); // send the SMS the number Serial.print(34,BYTE); // send the " char Serial.print("*********"); // send the number change ********* by the actual number Serial.println(34,BYTE); // send the " char delay(1500); Serial.print("Hola caracola..."); // the SMS body delay(500); Serial.print(0x1A,BYTE); // end of message command 1A (hex) delay(5000);
count++; }
if (count == timesToSend){ Serial.println("AT*PSCPOF"); // switch the module off count++; } }
mais il y a une erreur avec le BYTEpouvez vous m aider?
|
|
|
|
|
Logged
|
|
|
|
|
83 - var
Offline
Sr. Member
Karma: 0
Posts: 452
ARDUINO Powa !
|
 |
« Reply #2 on: May 02, 2012, 07:43:30 am » |
remplace les print par des write dans ton loop Serial.print => Serial.write..
pas sur mais a tenter..
Skizo!
|
|
|
|
|
Logged
|
Un tien vaux mieux que deux tu l'auras !
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #3 on: May 02, 2012, 07:45:25 am » |
oki je tente je te dis si ca marche
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #4 on: May 02, 2012, 07:51:18 am » |
meme c est pas ca le probleme quand je compile j ai toujours the "byte" keyword is no longer supported
|
|
|
|
|
Logged
|
|
|
|
|
83 - var
Offline
Sr. Member
Karma: 0
Posts: 452
ARDUINO Powa !
|
 |
« Reply #5 on: May 02, 2012, 07:55:35 am » |
int led = 13; int onModulePin = 2; // the pin to switch on the module (without press on button)
int timesToSend = 1; // Numbers of SMS to send int count = 0;
void switchModule(){ digitalWrite(onModulePin,HIGH); delay(2000); digitalWrite(onModulePin,LOW); }
void setup(){
pinMode(led, OUTPUT); pinMode(onModulePin, OUTPUT);
Serial.begin(19200); // the GPRS baud rate switchModule(); // swith the module ON for (int i=0;i<2;i++){ delay(5000); } Serial.println("AT+CMGF=1"); // set the SMS mode to text }
void loop(){ while (count < timesToSend){ delay(1500); Serial.print("AT+CMGS="); // send the SMS the number Serial.write(0x34); //ou Serial.print('"'); // send the " char Serial.print("*********"); // send the number change ********* by the actual number Serial.write(0x34); //ou Serial.print('"'); // send the " char delay(1500); Serial.print("Hola caracola..."); // the SMS body delay(500); Serial.write(0x1A); // end of message command 1A (hex) delay(5000);
count++; }
if (count == timesToSend){ Serial.println("AT*PSCPOF"); // switch the module off count++; } }
voila monsieur ^^ Skizo !
|
|
|
|
« Last Edit: May 02, 2012, 07:57:12 am by skizoh »
|
Logged
|
Un tien vaux mieux que deux tu l'auras !
|
|
|
|
Made in Belgium
Offline
God Member
Karma: 0
Posts: 756
|
 |
« Reply #6 on: May 02, 2012, 08:05:32 am » |
Serial.print(0x1A,BYTE); print et println sont des méthode pour envoyer des caractères ou chaine de caractères, lorsque tu fais BYTE (Cette constante existe ? version 1.0 ?) tu demande juste de donner la correspondance ascii de cette valeur et non cette valeur même. Si tu veux envoyer ta valeur decimal ou hexa d'un octet/byte (c'est pareil mais pas la même base  ) tu dois faire write(taValeur) comme spécifié par skizo.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #7 on: May 02, 2012, 08:07:01 am » |
merci de ton aide mais avec les prints j obtient (dans le serial monitor)
AT+CMGF=1 AT+CMGS=52(0033)*********52bonjour a tousAT*PSCPOF (sans retour )
et avec les write j obtiens
AT+CMGF=1 AT+CMGS=4(0033)*********4bonjour a tousAT*PSCPOF (pareil sans retour)
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #8 on: May 02, 2012, 08:08:55 am » |
je suis sous l ide arduino 1.0 et merci pour ta réponse osaka je comprend mieux
|
|
|
|
« Last Edit: May 02, 2012, 08:11:19 am by djo54150 »
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #9 on: May 02, 2012, 08:25:52 am » |
c est les retours qu il veut pas faire :/
toujours tout sur la meme ligne
|
|
|
|
|
Logged
|
|
|
|
|
Made in Belgium
Offline
God Member
Karma: 0
Posts: 756
|
 |
« Reply #10 on: May 02, 2012, 08:28:00 am » |
merci de ton aide mais avec les prints j obtient (dans le serial monitor)
Attention si ton shield utilise le port serie de ton arduino pin0 (rx) et pin1 (tx), elle sont également utilisé (via l'usb) pour ta programmation et ton serial monitor. Donc ne pas faire les deux en même temps ... AT+CMGF=1 AT+CMGS=52(0033)*********52bonjour a tousAT*PSCPOF (sans retour )
et avec les write j obtiens
AT+CMGF=1 AT+CMGS=4(0033)*********4bonjour a tousAT*PSCPOF (pareil sans retour)
Ton shield à besoin de se retour ? Pour afficher la commande sur ton monitor ok c'est plus propre, mais ton shield il n'en a pas besoin, juste la valeur hexa ou dec qui correspond à une commande ' " ' ?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #11 on: May 02, 2012, 08:42:56 am » |
quand je le programme apres je dois bouger un cavalier pour l utiliser donc je pense qu il n y a pas de conflit pour les transmissions si c est juste une question d affichage car mon shield a juste besoin de la valeur mais je ne sais pas si tu as vu mais il y a un 4 qui traine alors qu il devrait pas merci a vous de vous penchez sur mon cas
|
|
|
|
|
Logged
|
|
|
|
|
83 - var
Offline
Sr. Member
Karma: 0
Posts: 452
ARDUINO Powa !
|
 |
« Reply #12 on: May 02, 2012, 08:45:11 am » |
autant pour moi mets ça =)
Serial.write("\"");
voila c'est bon je l'ai testé !
Skizo !
|
|
|
|
|
Logged
|
Un tien vaux mieux que deux tu l'auras !
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 81
|
 |
« Reply #13 on: May 02, 2012, 08:52:07 am » |
bon petit récapitulatif ... int led = 13; int onModulePin = 2; // the pin to switch on the module (without press on button)
int timesToSend = 1; // Numbers of SMS to send int count = 0;
void switchModule(){ digitalWrite(onModulePin,HIGH); delay(2000); digitalWrite(onModulePin,LOW); }
void setup(){
pinMode(led, OUTPUT); pinMode(onModulePin, OUTPUT);
Serial.begin(19200); // the GPRS baud rate switchModule(); // swith the module ON for (int i=0;i<2;i++){ delay(5000); } Serial.println("AT+CPIN=3470"); delay(8000); Serial.println("AT+CMGF=1"); // set the SMS mode to text }
void loop(){ while (count < timesToSend){ delay(1500); Serial.print("AT+CMGS="); // send the SMS the number Serial.write("\""); //ou Serial.print('"'); // send the " char Serial.print("0033626955476"); // send the number change ********* by the actual number Serial.write("\""); //ou Serial.print('"'); // send the " char delay(1500); Serial.print("bonjour a tous "); // the SMS body delay(500); Serial.write(0x1A); // end of message command 1A (hex) delay(5000);
count++; }
if (count == timesToSend){ Serial.println("AT*PSCPOF"); // switch the module off count++; } }
normalement je devrais recevoir mon petit sms mais toujours pas  es-ce un pb de la carte luxo sur mon mobile francais ?)
|
|
|
|
|
Logged
|
|
|
|
|
83 - var
Offline
Sr. Member
Karma: 0
Posts: 452
ARDUINO Powa !
|
 |
« Reply #14 on: May 02, 2012, 08:57:26 am » |
Je ne pourrais pas plus t'aider je n'ai jamais utilisé ce module, tu va bien trouver un expert dans le coin t’inquiète, bon courage =)
Skizo !
|
|
|
|
|
Logged
|
Un tien vaux mieux que deux tu l'auras !
|
|
|
|
|