Hello All, great to know about this forum
I’ve just got the NB-IoT shield lately and I am using MEGA 2560 kit.
It seems I have some problems getting the AT commands to work I am getting nothing when I send AT in the serial monitor , here is the sketch I used :
#include "Arduino.h"
#if defined(ARDUINO_AVR_LEONARDO)
#define SerialOut Serial
#define UBLOX Serial1
#elif defined(ARDUINO_SODAQ_EXPLORER)
#define SerialOut SerialUSB
#define UBLOX Serial
#elif defined(ARDUINO_SAM_ZERO)
#define SerialOut SerialUSB
#define UBLOX Serial1
#elif defined(ARDUINO_AVR_MEGA2560)
#define SerialOut Serial
#define UBLOX Serial
#else
#error "Please select a Sodaq ExpLoRer, Arduino Leonardo or add your board."
#endif
// Pin to turn on/off the nb-iot module
#define powerPin 7
void setup()
{
// Turn the nb-iot module on
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, HIGH);
// Start communication
SerialOut.begin(9600);
UBLOX.begin(9600);
}
// Forward every message to the other serial
void loop()
{
while (SerialOut.available())
{
uint8_t c = SerialOut.read();
SerialOut.write(c);
UBLOX.write(c);
}
while (UBLOX.available())
{
SerialOut.write(UBLOX.read());
}
}
Uploading the sketch went successfully, but the outcome is nothing.
Any suggestions , I am pretty new to this and hope I am not missing silly operations.
Thanks Gabriel , but this did not work.
I don’t know if this NB-IoT shield is compatible with Arduino MEGA 2560 or not or is there minor changes in the code I should change.
It should be compatible. The only issue is that Serial is used for both connecting to the USB and to the header pins 0/1 (which are connected to the NBIoT module).
You could try removing this line:
Serial.begin(9600);
as it should be unnecessary as the MCU is not sending data over the USB connection. This should allow a direct connection to the NBIoT module.
Make sure you are sending both cr/lf as your line endings.