|
This code example,
illustrates how Easy is to Work with the Pix-Cell GSM Controller. This
example waits for a Digital Pulse Signal on Input Number 1, turns ON the Green LED and
send a SMS Message to a Mobile
Phone.
void
main()
{
unsigned char
phone_num[]="+972520000000",msg[]="Alarm
is ON";
InitBrd();
// Initialize the PixCell GSM Board functions.
GreenLED(0);
// Turn OFF the green LED (UControl Driver)
while (!CheckModem());
// Checks if the modem is connected (UControl
Driver)
while (!SmsInit());
// Iniatilize the GSM modem for SMS (UControl
Driver)
while (1)
{
while
(BitRdInput(1));
// waits until a logical 1 is received on Input 1 (UControl
Driver)
Delay_ml(15);
// Delay of 15mS for stability of the input.
while
(!BitRdInput(1));
// waits until the input signal return to logical 0.
GreenLED(1);
// Turn the green LED ON
if
(SendSms("+972520000000","Alarm
is ON"))
GreenLED(0);
// Send a SMS.
//you can
also use
this form:
SendSms(phone_num,msg);
}
}
|