pls help, turn on and off led using gsm shield arduino

im new in this forum,. i use arduino for basic programs like controlling led lights. but never in gsm shield.

can you pls help me, i want to turn on or off the led via text message using gsm shield.

im a beginner in the gsm shield (sim900).

can you pls explain how the program works. thank you very much.

can you pls explain how the program works.

Sure. You post the program, and we'll explain it.

pls is gibberish. I don't expect to see it here again.

thanks, i want to modify from this one by turning the red light as on and the green light as off (led on off only)

1 //GSM Shield for Arduino
2 //www.open-electronics.org
3 //this code is based on the example of Arduino Labs
4
5 #includeSIM900.h”
6 #include “sms.h”
7 #include “SoftwareSerial.h”
8 #include “sms.h”
9 SMSGSM sms;
10 int red = 10; // RED LED connected to PWM pin 3
11 int green = 5; // GREEN LED connected to PWM pin 5
12 int blue = 6; // BLUE LED connected to PWM pin 6
13 int r=50; int g=100; int b=150;
14 int rup; int gup; int bup;
15
16 boolean started=false;
17 char smsbuffer[160];
18 char n[20];
19 int fader=1;
20 int inc=10;
21
22 void setup()
23 {
24 //Serial connection.
25 Serial.begin(9600);
26 Serial.println(“GSM Shield testing.”);
27 //Start configuration of shield with baudrate.
28 if (gsm.begin(2400)){
29 Serial.println("\nstatus=READY");
30 started=true;
31 }
32 else Serial.println("\nstatus=IDLE");
33 if(started){
34 delsms();
35 }
36
37 };
38
39 void loop()
40 {
41 int pos=0;
42 //Serial.println(“Loop”);
43 if(started){
44 pos=sms.IsSMSPresent(SMS_ALL);
45 if(pos){
46 Serial.println("IsSMSPresent at pos “);
47 Serial.println(pos);
48 sms.GetSMS(pos,n,smsbuffer,100);
49 Serial.println(n);
50 Serial.println(smsbuffer);
51 if(!strcmp(smsbuffer,“R”)){
52 Serial.println(“RED”);
53 r=255;
54 g=0;
55 b=0;
56 }
57 if(!strcmp(smsbuffer,“G”)){
58 Serial.println(“GREEN”);
59 r=0;
60 g=255;
61 b=0;
62 }
63 if(!strcmp(smsbuffer,“B”)){
64 Serial.println(“BLUE”);
65 r=0;
66 g=0;
67 b=255;
68 }
69 if(!strcmp(smsbuffer,“P”)){
70 Serial.println(“PURPLE”);
71 r=255;
72 g=0;
73 b=255;
74 }
75 if(!strcmp(smsbuffer,“Y”)){
76 Serial.println(“YELLOW”);
77 r=255;
78 g=255;
79 b=0;
80 }
81 if(!strcmp(smsbuffer,“O”)){
82 Serial.println(“ORANGE”);
83 r=255;
84 g=165;
85 b=0;
86 }
87 if(!strcmp(smsbuffer,“W”)){
88 Serial.println(“WHITE”);
89 r=255;
90 g=255;
91 b=255;
92 }
93 if(!strcmp(smsbuffer,“F”)){
94 Serial.println(“FADER”);
95 fader=1;
96 r=50; g=100; b=150;
97 }
98 else
99 {
100 fader=0;
101 }
102 rgb(r, g, b);
103 delsms();
104
105 }
106 if(fader){
107 funcfader();
108 }
109
110 }
111 };
112
113 void delsms(){
114 Serial.println(“delsms”);
115 for (int i=0; i<10; i++){ //do it max 10 times
116 int pos=sms.IsSMSPresent(SMS_ALL);
117 if (pos!=0){
118 Serial.print(”\nFind SMS at the pos “);
119 Serial.println(pos);
120 if (sms.DeleteSMS(pos)==1){
121 Serial.print(”\nDeleted SMS at the pos “);
122 Serial.println(pos);
123 }
124 else
125 {
126 Serial.print(”\nCant del SMS at the pos ");
127 Serial.println(pos);
128 }
129 }
130 }
131
132 }
133
134 void funcfader(){
135 if (rup==1){r+=1;}
136 else{r-=1;}
137 if (r>=255){rup=0;}
138 if (r<=0){rup=1;}
139
140 if (gup==1){g+=1;}
141 else{g-=1;}
142 if (g>=255){gup=0;}
143 if (g<=0){gup=1;}
144
145 if (bup==1){b+=1;}
146 else{b-=1;}
147 if (b>=255){bup=0;}
148 if (b<=0){bup=1;}
149 rgb(r, g, b);
150 }
151
152 void rgb(int r, int g, int b)
153 {
1 if (r>255) r=255;
2 if (g>255) g=255;
3 if (b>255) b=255;
4 if (r<0) r=0;
5 if (g<0) g=0;
6 if (b<0) b=0;
7
8 analogWrite(red, r);
9 analogWrite(green, g);
10 analogWrite(blue, b);
11 }

That is not how you post code...

Read this before posting a programming question

6. Getting help on the forum

There are quite a few experienced people on the forum anxious to help you, and help you get as much as you can out of your Arduino. You can help them do that by making helpful posts:

  • Make an informative subject description, not "help me, I'm a noob", nor something in all capitals. Try to avoid saying "urgent". That's your problem, not ours.
  • Describe your problem in detail.
  • If it relates to an electronics part (chip or board), give the exact part number and preferably a link to the data sheet.
  • Describe how you have connected things like switches. Are they wired to ground? Or +5V? Are there pull-up or pull-down resistors? Post a circuit if there is doubt.
  • Post your complete sketch (program code)! If you don't you waste time while people ask you to do that.
  • When you post your code put it between ... tags. You can do that by hitting the # button above the posting area.
  • If you get an error, post the error (copy and paste). Not just "I got an error".
  • With coding problems, if possible post a "minimal" sketch that demonstrates the problem - not hundreds of lines of code.
  • If you have debugging information in your sketch, post your debugging displays.
  • Describe what you expected to happen, and what actually happened. Not just "it doesn't work".
  • If possible, describe what you are really trying to do, not what you think might work. For example "I am trying to turn on an aquarium heater and pump at the same time", not "how do I break out of an interrupt?".
  • Don't double-post (cross-post). Your question will be noticed. If you post it in multiple places you will just annoy people who might otherwise have answered.
1   //GSM Shield for Arduino
2   //www.open-electronics.org
3   //this code is based on the example of Arduino Labs
4    
5   #include "<a title="SIM900" class="aal" target="_blank" rel="nofollow" href="http://store.open-electronics.org/Breakout/GSM%20Breakout">SIM900</a>.h"
6   #include "sms.h"
7   #include "SoftwareSerial.h"
8   #include "sms.h"
9   SMSGSM sms;
10   int red = 10;    // RED LED connected to PWM pin 3
11   int green = 5;    // GREEN LED connected to PWM pin 5
12   int blue = 6;    // BLUE LED connected to PWM pin 6
13   int r=50; int g=100; int b=150;
14   int rup; int gup; int bup;
15    
16   boolean started=false;
17   char smsbuffer[160];
18   char n[20];
19   int fader=1;
20   int inc=10;
21    
22   void setup() 
23   {
24     //Serial connection.
25     Serial.begin(9600);
26     Serial.println("GSM Shield testing.");
27     //Start configuration of shield with baudrate.
28     if (gsm.begin(2400)){
29       Serial.println("\nstatus=READY");
30       started=true;  
31     }
32     else Serial.println("\nstatus=IDLE");
33     if(started){
34       delsms();
35     }
36    
37   };
38    
39   void loop() 
40   {
41     int pos=0;
42     //Serial.println("Loop");
43     if(started){
44       pos=sms.IsSMSPresent(SMS_ALL);
45       if(pos){
46         Serial.println("IsSMSPresent at pos ");
47         Serial.println(pos); 
48         sms.GetSMS(pos,n,smsbuffer,100);
49           Serial.println(n);
50           Serial.println(smsbuffer);
51           if(!strcmp(smsbuffer,"R")){
52             Serial.println("RED");
53             r=255;                                          
54             g=0;
55             b=0;
56           }      
57           if(!strcmp(smsbuffer,"G")){
58             Serial.println("GREEN");
59             r=0;
60             g=255;
61             b=0;
62           }    
63           if(!strcmp(smsbuffer,"B")){
64             Serial.println("BLUE");
65             r=0;
66             g=0;
67             b=255;
68           }  
69           if(!strcmp(smsbuffer,"P")){
70             Serial.println("PURPLE");
71             r=255;
72             g=0;
73             b=255;
74           }  
75           if(!strcmp(smsbuffer,"Y")){
76             Serial.println("YELLOW");
77             r=255;
78             g=255;
79             b=0;
80           }  
81           if(!strcmp(smsbuffer,"O")){
82             Serial.println("ORANGE");
83             r=255;
84             g=165;
85             b=0;
86           }  
87           if(!strcmp(smsbuffer,"W")){
88             Serial.println("WHITE");
89             r=255;
90             g=255;
91             b=255;
92           }  
93           if(!strcmp(smsbuffer,"F")){
94             Serial.println("FADER");
95             fader=1;
96             r=50; g=100; b=150;
97           }
98           else
99           {
100             fader=0;
101           }  
102           rgb(r, g, b);
103           delsms();
104    
105       }
106       if(fader){
107         funcfader();
108       }
109    
110     }
111   };
112    
113   void delsms(){
114     Serial.println("delsms");
115     for (int i=0; i<10; i++){  //do it max 10 times
116         int pos=sms.IsSMSPresent(SMS_ALL);
117         if (pos!=0){
118           Serial.print("\nFind SMS at the pos ");
119           Serial.println(pos); 
120           if (sms.DeleteSMS(pos)==1){    
121             Serial.print("\nDeleted SMS at the pos ");
122             Serial.println(pos);      
123           }
124           else
125           {
126             Serial.print("\nCant del SMS at the pos ");
127             Serial.println(pos);         
128           }
129         }
130       }
131    
132   }
133    
134   void funcfader(){
135       if (rup==1){r+=1;}
136       else{r-=1;}
137       if (r>=255){rup=0;}
138       if (r<=0){rup=1;}
139    
140       if (gup==1){g+=1;}
141       else{g-=1;}
142       if (g>=255){gup=0;}
143       if (g<=0){gup=1;}
144    
145       if (bup==1){b+=1;}
146       else{b-=1;}
147       if (b>=255){bup=0;}
148       if (b<=0){bup=1;}  
149       rgb(r, g, b);
150   }
151    
152   void rgb(int r, int g, int b)
153   {
1     if (r>255) r=255;
2     if (g>255) g=255;
3     if (b>255) b=255;
4     if (r<0) r=0;
5     if (g<0) g=0;
6     if (b<0) b=0;
7    
8     analogWrite(red, r); 
9     analogWrite(green, g); 
10     analogWrite(blue, b);   
11   }
5   #include "<a title="SIM900" class="aal" target="_blank" rel="nofollow" href="http://store.open-electronics.org/Breakout/GSM%20Breakout">SIM900</a>.h"

What the hell is this?

ok i think no one can help me.. =(

i feel so dumb.

i dont know nothing with this program. i have no idea specially gsm shield.

i only know running lights and any other basic pin asignments... and im stuck and dead stop.! :disappointed_relieved:

ok i think no one can help me..

Where did you get that code? It looks like it was posted on a wen site,

What problems are you having? Are you able to send and receive SMSs?

yes from this website. http://www.open-electronics.org/ikea-sms-lamp-with-gsm-shield/

since i cant find website or basic example using basic on off via gsm shield (even in youtube) all of them are so complicated.,

though i have a downloaded program that can send message from the gsm shield to my phone. but what about from my phone sending instruction to the gsm shield? like this person did IKEA lamp mod - SMS LAMPAN - YouTube

sorry for my english. i think im a trying hard learner from the country that does not offer much of this kind of technology.

So, break the problem down.
Junk the code that lights stuff, and concentrate on just getting messages in reliably.

http://store.open-electronics.org/Breakout/UltraSonic%20Ranger

!!! OMG !!!

5 or more 20.43€ rip off..

http://www.ebay.com.au/itm/New-Measuring-Transducer-Ultrasonic-Module-HC-SR04-Distance-Sensor-For-Arduino-/110845633157?pt=AU_B_I_Electrical_Test_Equipment&hash=item19ceea2285
cost for just 1 and free shipping $2.39 (not 20.43 Euros)! 5pcs would be cheaper still.. who shops at this site?

cjdelphi:
Ultra-Sonic Ranger- Ultrasound sensor operating at 40 kHz- frontally provided wi

!!! OMG !!!

5 or more 20.43€ rip off..

http://www.ebay.com.au/itm/New-Measuring-Transducer-Ultrasonic-Module-HC-SR04-Distance-Sensor-For-Arduino-/110845633157?pt=AU_B_I_Electrical_Test_Equipment&hash=item19ceea2285
cost for just 1 and free shipping $2.39 (not 20.43 Euros)! 5pcs would be cheaper still.. who shops at this site?

In the context of LEDs and GSM, that's something of a non sequitur, don't you think?