Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial pdu_serial(2,3);
  4.  
  5. void setup() {
  6.  
  7. String msg = "Hello world PDU";
  8. String num = "+639175090208";
  9.  
  10. // initialize serial communications and wait for port to open:
  11. Serial.begin(9600);
  12. while (!Serial) {
  13. ; // wait for serial port to connect. Needed for native USB port only
  14. }
  15. Serial.println("SMS Messages Sender");
  16. Serial.println(num);
  17. Serial.println(msg);
  18.  
  19. pdu_serial.begin(9600);
  20. while (!pdu_serial) {
  21. ; // wait for serial port to connect. Needed for native USB port only
  22. }
  23. pdu_serial.print("AT+CMGF=1\r");
  24. delay(2000);
  25. pdu_serial.print("AT+CMGS=\"" + num + "\"\r");
  26. delay(1000);
  27. pdu_serial.print(msg);
  28. delay(1000);
  29. pdu_serial.write((char)26); //ctrl+z
  30. Serial.println("\nCOMPLETE!\n");
  31. }
  32.  
  33. void loop() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement