0% found this document useful (0 votes)
36 views

COBA

The code initializes serial communication with a GPRS module and makes calls by sending AT commands to control GPIO pins and PWM signals in a loop. It dials a phone number, toggles the GPIO pins and PWM signals on and off in sequence with delays, ends the call after 5 loops, and reads any response from the module.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

COBA

The code initializes serial communication with a GPRS module and makes calls by sending AT commands to control GPIO pins and PWM signals in a loop. It dials a phone number, toggles the GPIO pins and PWM signals on and off in sequence with delays, ends the call after 5 loops, and reads any response from the module.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <SoftwareSerial.

h>
SoftwareSerial mySerial(2, 3);
void setup()
{
mySerial.begin(19200); // the GPRS baud rate
Serial.begin(19200); // the GPRS baud rate
delay(2000);
}
void loop()
{
int count=0;
mySerial.println("ATD 083899698969;"); // xxxxxxxxx is the number you want to di
al, Noice the ";" in the end
delay(2000);
while(1)
{
mySerial.println("AT+SPWM=2,63,100");// set PWM 2 PIN
delay(100);
mySerial.println("AT+SPWM=1,63,100");
delay(100);
mySerial.println("AT+SGPIO=0,1,1,1");// set GPIO 1 PIN to 1
delay(100);
mySerial.println("AT+SGPIO=0,2,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,3,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,4,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,5,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,6,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,7,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,8,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,9,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,10,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,11,1,1");
delay(100);
mySerial.println("AT+SGPIO=0,12,1,1");
delay(500);
mySerial.println("AT+SPWM=1,63,0");
delay(100);
mySerial.println("AT+SPWM=2,63,0");
delay(100);
mySerial.println("AT+SGPIO=0,1,1,0"); // set GPIO 1 PIN to 0
delay(100);
mySerial.println("AT+SGPIO=0,2,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,3,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,4,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,5,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,6,1,0");
delay(100);

mySerial.println("AT+SGPIO=0,7,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,8,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,9,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,10,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,11,1,0");
delay(100);
mySerial.println("AT+SGPIO=0,12,1,0");
delay(500);
count++;
if(count==5)
{
mySerial.println("ATH"); //end the call.
if(mySerial.available())
{
Serial.print((unsigned char)mySerial.read());
}
}
}
}

You might also like