Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <NewSoftSerial.h>
- char incoming_char=0; //Will hold the incoming character from the Serial Port.
- NewSoftSerial phone(2, 3);
- const int buttonPin = 26;
- int buttonState = 0;
- void setup() {
- Serial.begin(9600);
- phone.begin(9600);
- pinMode(buttonPin, INPUT);
- }
- void loop() {
- //buttonState = digitalRead(buttonPin);
- //if (buttonState == HIGH) {
- //phone.println("ATD+972544879161;");
- // delay(1500);
- // }
- //If a character comes in from the cellular module...
- if(phone.available() >0)
- {
- incoming_char=phone.read(); //Get the character from the cellular serial port.
- Serial.print(incoming_char); //Print the incoming character to the terminal.
- }
- //If a character is coming from the terminal to the Arduino...
- if(Serial.available() >0)
- {
- incoming_char=Serial.read(); //Get the character coming from the terminal
- phone.print(incoming_char); //Send the character to the cellular module.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement