===============================================================
#include "application.h"
#include "cellular_hal.h"
STARTUP(cellular_credentials_set("TM", "", "", NULL));
const char* phNum = "+39347107xxxx";
const char* msg = "Interrupt fired";
int ret;
void setup()
{
pinMode(D7, OUTPUT);
pinMode(D2, INPUT_PULLDOWN); // sets pin as input
}
void loop()
{
digitalWrite(D7, HIGH);
System.sleep(D2,FALLING);
Cellular.on();
Cellular.connect();
delay(20000);
if (Cellular.ready() == true)
{
ret = Cellular.command("AT+CMGF=1\r\n");
ret = Cellular.command("AT+CMGS=\"%s%s\",129\r\n",(phNum[0] != '+') ? "+" : "", phNum); //
ret = Cellular.command("%s\x1a", msg);
digitalWrite(D7, LOW);
delay(5000);
}
}
Nessun commento:
Posta un commento