Advertisement
sftb

ACESSO REMOTO

Nov 29th, 2015
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include "SIM900.h"
  2. #include <SoftwareSerial.h>
  3. #include "sms.h"
  4. SMSGSM sms;
  5.  
  6. int numdata;
  7. boolean started=false;
  8. char smsbuffer[160];
  9. char n[20];
  10.  
  11. char sms_position;
  12. char phone_number[20];
  13. char sms_text[100];
  14. int i;
  15.  
  16. void setup()
  17. {
  18. Serial.begin(9600);
  19.  
  20. if (gsm.begin(9600))
  21. {
  22. Serial.println("\nstatus=READY");
  23. started=true;
  24. }
  25. else
  26. Serial.println("\nstatus=IDLE");
  27.  
  28. if(started)
  29. {
  30. if (sms.SendSMS("+300000000000", "Arduino SMS"))
  31. {
  32. Serial.println("\nSMS sent OK.");
  33. }
  34. else
  35. {
  36. Serial.println("\nError sending SMS.");
  37. }
  38. }
  39. };
  40.  
  41. void loop()
  42. {
  43. if(started)
  44. {
  45. sms_position=sms.IsSMSPresent(SMS_UNREAD);
  46. if (sms_position)
  47. {
  48. Serial.print("SMS postion:");
  49. Serial.println(sms_position,DEC);
  50. sms.GetSMS(sms_position, phone_number, sms_text, 100);
  51. Serial.println(phone_number);
  52. Serial.println(sms_text);
  53. }
  54. delay(2000);
  55. }
  56. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement