Hi @alvaro, this is my code so far, but not seem to be working. Do you have any ideas about what could I have done wrong?
‘’’
#define TINY_GSM_MODEM_SIM900
#define DEBUG
#include <TinyGsmClient.h>
#include <ThingerGPRS.h>
#include <SPI.h>
#include “sms.h”
#include <Wire.h>
char mob_num[]="+5565996357512"; //numero do chip
#define USERNAME “Freitas”
#define DEVICE_ID “LED”
#define DEVICE_CREDENTIAL “credenciais”
ThingerGPRS thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);
SMSGSM sms;
String smsText = "Rafael: Teste do projeto em ";
boolean started=false;
char sms_text[160];
#define LED 5
int sensor = 9;
#define MAX_CARDS 5
#define CARD_ID_LENGTH 20
char auth_cards[MAX_CARDS][CARD_ID_LENGTH] = {“a12345678910”, //my cell phone number here
"b12345678910",
“c12345678910”};
void setup(){
Serial.begin(9600);
Serial.println(“INICIALIZANDO SIM900”);
pinMode(48,OUTPUT);
digitalWrite(48,HIGH);
delay(500);
digitalWrite(48,LOW);
delay(500);
Wire.begin();
// rtc.begin();
pinMode (sensor, INPUT);
pinMode (LED,OUTPUT);
if (gsm.begin(9600)) {
Serial.println("\nstatus=READY");
started=true;
}
else
Serial.println("\nstatus=IDLE");
// Serial GPRS
Serial1.begin(9600);
// Definir APN
thing.setAPN("zap.vivo.com.br", "vivo", "vivo");
thing["auth_cards"] << [](pson& in){
// provide current auth devices
if(in.is_empty()){
pson_array& array = in;
for(int i=0; i<MAX_CARDS; i++){
array.add((const char*)auth_cards[i]); }
// update current cards
}else if(in.is_array()){
pson_array& array = in;
for(int i=0; i<array.size() && i<MAX_CARDS; i++) {
const char *card_id = (const char *) *array[i];
if(strlen(card_id)>CARD_ID_LENGTH) continue;
strcpy(auth_cards[i], card_id);
}
}
};
}
void mostraResposta(){
while(Serial1.available()!=0){
Serial.write(Serial1.read()); }
}
void loop(){
thing.handle();
if (sensor == HIGH){
digitalWrite(LED, HIGH);
//timestamp = getDateTime();
//Serial.println(timestamp);
//smsText = smsText+timestamp;
smsText.toCharArray(sms_text,160);
sms.SendSMS(“auth_cards[0]”,sms_text); //is this way right??
sms.SendSMS(“auth_cards[1]”,sms_text); //is this way right??
String smsText = "Rafael: Teste do projeto em ";
}
}
’’’