Unable to authenticate my arduino mega, while same process is working on uno.
Hi, can you please share your code and enable the debug in the code to see what is happening?
Best.
// 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
// uncomment line for debug
#define DEBUG
// Can be installed from Library Manager or https://github.com/vshymanskyy/TinyGSM
#include <TinyGsmClient.h>
#include <ThingerTinyGSM.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 mySerial(10, 11); // RX, TX
#endif
#define USERNAME “sneh25”
#define DEVICE_ID “DD12”
#define DEVICE_CREDENTIAL “B#EZaYoGuvpb”
// use your own APN config
#define APN_NAME “airtelgprs.com”
#define APN_USER “”
#define APN_PSWD “”
// set your cad pin (optional)
//#define CARD_PIN “”
ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, mySerial);
void setup() {
// uncomment line for debug
Serial.begin(9600);
// Serial for AT commands (can be higher with HW Serial, or even lower in SW Serial)
mySerial.begin(9600);
// 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(13, OUTPUT);
thing[“relay”] << digitalPin(13);
// resource output example (i.e. reading a sensor value)
// thing[“millis”] >> outputValue(millis());
thing[“millis”] >> [](pson& out){
out = millis();
};
// more details at http://docs.thinger.io/arduino/
}
void loop() {
thing.handle();
}
When I compile it for Uno it works fine, but on ArduinoMega compilation error occurs for Software Serial library. As i says “mySerial” is not defined in the scope. I tried to run it by using other UART ports but then it is unable to get Authenticated on thinger.io Socket.
Hi, so, are you able to even compile the sketch and flash it to the Mega?
I an Arduino Mega, I recommend you to use a hardware serial (i.e. Serial1). This way, you can avoid using the Software Serial, and it should work better.