Help for GSM Remote Control
hello ! i'm trying make gsm remote control these arduino parts http://store.arduino.cc/index.php?main_page=product_info&cpath=11&products_id=195
http://store.arduino.cc/index.php?main_page=product_info&cpath=37_5&products_id=282
http://store.arduino.cc/index.php?main_page=product_info&cpath=16_20&products_id=113
does know code must upload make ?
http://store.arduino.cc/index.php?main_page=product_info&cpath=37_5&products_id=282
http://store.arduino.cc/index.php?main_page=product_info&cpath=16_20&products_id=113
does know code must upload make ?
i have modified code project http://scuola.arduino.cc/lesson/lvevk1a/using_sms_messages_to_control_led_color because want control pin13 in order connect relay !
i made code : #include <gsm.h> // includes gsm library, included in arduino ide
#define pinnumber "" // declaration of constant pinnumber used push pin number of sim card
#define pin 13 // declaration of constant pin, , setting output nr. 6
gsm gsmaccess; // opens gsm access on shield.
gsm_sms sms;
char remotenumber[20]; // variable store remote number modem.
char c; //variable reading sms messages sim card
int x=0; //counter number of sms messages processed
char lastm; //variable stop sms replying
string lastmess; //for storing whole message
// **** 2 setup ****
void setup() {
//setup sms recieving. serial setup makes possible monitor status on pc while connected
serial.begin(9600);
serial.println("sms recieving");
boolean notconnected = true; // defines variable indicates no gsm connection if true
while(notconnected) { // if there no connection, program runs gsmacess. gsmacess returns gsm_ready when connected
if(gsmaccess.begin(pinnumber"0462")==gsm_ready) // if have pin number on sim card, write parameters here in quotes. pinnumber"9876"
notconnected = false;
else {
//messages printed on serial monitor or lcd screen, tries again in 1000 milliseconds
serial.println("no connection");
}
}
// if connection established
serial.println("gsm connected"); //gsm connected
serial.println("waiting"); //waiting sms
}
// **** 3 loop ****
void loop() {
if (lastmess == "h")
{
digitalwrite(13,high);
}
else if (lastmess == "l")
{
digitalwrite(13,low);
}
//reading messages
if (sms.available()) // if there sms on sim card
{
x++; //message counter adds one
sms.remotenumber(remotenumber, 20);
//show message on monitor
serial.println("messages received from");
serial.println(remotenumber); //prints senders number on serial monitor
serial.println("message:");
while(c=sms.read()) {
string nextchar = string (c);
string mess = (lastmess + nextchar);
lastmess = mess;
/*sms.read collects 1 digit of messages @ time , stores in variable c.
while loop builds string variable "lastmess" each byte in messages displaying.
*/
}
serial.println(lastmess); // prints whole messages on monitor , lcd screen
}//end for
sms.flush(); //discards sms message
}
i uploaded uno + gsm shield without errors , send sms "h" pin13 didn't go high , led didn't blink !
could me find mistakes @ code ? ?
here results of i've done http://postimg.org/image/v121wnhwr/
i made code : #include <gsm.h> // includes gsm library, included in arduino ide
#define pinnumber "" // declaration of constant pinnumber used push pin number of sim card
#define pin 13 // declaration of constant pin, , setting output nr. 6
gsm gsmaccess; // opens gsm access on shield.
gsm_sms sms;
char remotenumber[20]; // variable store remote number modem.
char c; //variable reading sms messages sim card
int x=0; //counter number of sms messages processed
char lastm; //variable stop sms replying
string lastmess; //for storing whole message
// **** 2 setup ****
void setup() {
//setup sms recieving. serial setup makes possible monitor status on pc while connected
serial.begin(9600);
serial.println("sms recieving");
boolean notconnected = true; // defines variable indicates no gsm connection if true
while(notconnected) { // if there no connection, program runs gsmacess. gsmacess returns gsm_ready when connected
if(gsmaccess.begin(pinnumber"0462")==gsm_ready) // if have pin number on sim card, write parameters here in quotes. pinnumber"9876"
notconnected = false;
else {
//messages printed on serial monitor or lcd screen, tries again in 1000 milliseconds
serial.println("no connection");
}
}
// if connection established
serial.println("gsm connected"); //gsm connected
serial.println("waiting"); //waiting sms
}
// **** 3 loop ****
void loop() {
if (lastmess == "h")
{
digitalwrite(13,high);
}
else if (lastmess == "l")
{
digitalwrite(13,low);
}
//reading messages
if (sms.available()) // if there sms on sim card
{
x++; //message counter adds one
sms.remotenumber(remotenumber, 20);
//show message on monitor
serial.println("messages received from");
serial.println(remotenumber); //prints senders number on serial monitor
serial.println("message:");
while(c=sms.read()) {
string nextchar = string (c);
string mess = (lastmess + nextchar);
lastmess = mess;
/*sms.read collects 1 digit of messages @ time , stores in variable c.
while loop builds string variable "lastmess" each byte in messages displaying.
*/
}
serial.println(lastmess); // prints whole messages on monitor , lcd screen
}//end for
sms.flush(); //discards sms message
}
i uploaded uno + gsm shield without errors , send sms "h" pin13 didn't go high , led didn't blink !
could me find mistakes @ code ? ?
here results of i've done http://postimg.org/image/v121wnhwr/
Arduino Forum > Products > Arduino GSM Shield (Moderator: fabioc84) > Help for GSM Remote Control
arduino
Comments
Post a Comment