Hello,
i am trying to run the following function with a software timer or an interrupt without success:
void test() {
const char* tel = "01234567890123";
placeCall(tel);
}
int placeCall(const char* telNr)
{
uint32_t duration = 30000;
int ret;
digitalWrite(led1,HIGH);
if (!strlen(telNr)) return -1;
if (!Cellular.ready())
{
Cellular.on();
Cellular.connect();
if (!waitFor(Cellular.ready, 5000))
{
Log.warn("no radio connection");
Serial.println("no radio!");
return -1;
}
}
if ((ret = Cellular.command("ATD%s;\r\n", telNr)) == RESP_OK)
{
Log.info("Call pending");
Serial.println("Call pending!");
delay(duration);
Cellular.command("AT+CHUP\r\n");
Log.info("Hung up");
Serial.println("Hung up!");
}
else
{
Log.warn("Call not possible (%d)", ret);
Serial.println("Call not possible!");
}
digitalWrite(led1,LOW);
return ret;
}
I now, there is a problem with using particle.publish with a timer but my function doesn´t include a publish…
In case of the timer, it ends with an SOS from the electron (13 times blinking)
in case of using an interrupt:
pinMode(D5, INPUT_PULLDOWN);
attachInterrupt(D5, test, RISING);
to run the “test” function, i get error “Call not possible” from placeCall()
Can anyone help me with my problem?
An idea to solve the problem may be very helpful!
Thanks a lot,
Stivi