#define THINGER_SERIAL_DEBUG
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_M590
// Can be installed from Library Manager or GitHub - vshymanskyy/TinyGSM: A small Arduino library for GSM modules, that just works
#include <TinyGsmClient.h>
#include <ThingerTinyGSM.h>
#include “arduino_secrets.h”
// Emulate Serial1 on pins 10/11 if HW is not present (use interrupt pin in RX for better performance)
#ifndef HAVE_HWSERIAL1
#include “SoftwareSerial.h”
SoftwareSerial Serial1(10, 11); // RX, TX
#endif
ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);
void setup() {
// open serial for debugging
Serial.begin(115200);
// Serial for AT commands (can be higher with HW Serial, or even lower in SW Serial)
Serial1.begin(57600);
// set APN (you can remove user and password from call if your apn does not require them)
thing.setAPN(APN_NAME, APN_USER, APN_PSWD);
// set PIN (optional)
// thing.setPIN(CARD_PIN);
// resource input example (i.e, controlling a digitalPin);
pinMode(LED_BUILTIN, OUTPUT);
thing[“led”] << digitalPin(LED_BUILTIN);
// resource output example (i.e. reading a sensor value)
thing[“millis”] >> outputValue(millis());
// more details at DEVICES - Thinger.io Documentation
}
void loop() {
thing.handle();
}