Go Down

Topic: led controlled via sms (Read 169 times) previous topic - next topic

czamer

hi !

we need your help with our arduino and sim900a .we're a beginner about this project .can u help us to make our project successful???any help appreciated



this code is copied in these forum .but we dont know if it is working .so pls help us!!!

lesept

#1
Oct 13, 2018, 11:42 pm Last Edit: Oct 13, 2018, 11:45 pm by lesept
What is the problem? Did you test your code?
Apparently, the code waits for an incoming SMS. The SMS must begin with '#' then 'a' (for the first led, maybe later you will control several leds), then
  • '0' to switch the led off
  • '1' to switch it on
  • 'S' to send back an SMS telling the led's status.

This last point must be changed, as for now the SMS does only contain 'LED STATUS: ON' whatever the status. You should change
Code: [Select]
 SIM900.println( " LED STATUS: ON ");                         // message to send
by
Code: [Select]
 if (led_status) SIM900.println( " LED STATUS: ON ");                         // message to send
  else SIM900.println( " LED STATUS: ON ");                         // message to send

and
Code: [Select]
void sendSMS(char led_status) {              //SEND SMS
by
Code: [Select]
void sendSMS(int led_status) {              //SEND SMS

But I can't test your code because I don't have a SIM900 module. I don't know if the way you manage the serial communication with the module is robust. You should read some tutorial (there is a good one here)
A force d'essayer on finit par réussir... Donc, plus ça rate, plus on a de chances que ça marche (proverbe Sharduinok).

Go Up