Advertisement
Guest User

Untitled

a guest
Jan 16th, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <NewSoftSerial.h>
  2.  
  3. char incoming_char=0; //Will hold the incoming character from the Serial Port.
  4. NewSoftSerial phone(2, 3);
  5. const int buttonPin = 26;
  6. int buttonState = 0;
  7.  
  8. void setup() {
  9. Serial.begin(9600);
  10. phone.begin(9600);
  11. pinMode(buttonPin, INPUT);
  12.  
  13. }
  14.  
  15. void loop() {
  16. //buttonState = digitalRead(buttonPin);
  17. //if (buttonState == HIGH) {
  18.  
  19. //phone.println("ATD+972544879161;");
  20. // delay(1500);
  21. // }
  22. //If a character comes in from the cellular module...
  23. if(phone.available() >0)
  24. {
  25. incoming_char=phone.read(); //Get the character from the cellular serial port.
  26. Serial.print(incoming_char); //Print the incoming character to the terminal.
  27. }
  28. //If a character is coming from the terminal to the Arduino...
  29. if(Serial.available() >0)
  30. {
  31. incoming_char=Serial.read(); //Get the character coming from the terminal
  32. phone.print(incoming_char); //Send the character to the cellular module.
  33. }
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement