let what works on arduino uno works on arduino mega2560

Hi,

I just received a SIM7000E Arduino NB-IoT/LTE/GPRS/GPS Expansion Shield and have it connected to Arduino with Zain simcard
I have been running the DFRobot_SIM7000_GetPosition code.

When testing the code on Aruino UNO all good and works good but when I connect the device with Arduino Mega2560 I get “Turn on SIM7000”

The Net Led on the shield blinks fast then slow (suspect connected) then about 12 seconds with nothing (suspect disconnected) which the online sim monitoring seems to agree with.

Also, I’ve changed the code as they asked me to in the beginning to it but what does they mean by connect pin 8 and 10?

help me please

here is the code:

/*

  • file : DFRobot_SIM7000_getPosition.ino
  • Power : SIM7000 needs 7-12V DC power supply
  • Brief : This example use for get longitude and latitude
  • With initialization completed, we use getPosition() to positioning current position
  • Use getLongitude() to get longitude(-180,180), negative is west positive is east
  • Use getLatitude() to get latitude(-90,90), negative is south positive is north
  • Note : If you use Mega please connect PIN8 PIN10 and set PIN_RX = 10
  • The positioning function only available in outdoor
    */

#include <Wire.h>
#include <DFRobot_SIM7000.h>

#define PIN_TX 7
#define PIN_RX 10
SoftwareSerial mySerial(PIN_RX,PIN_TX);
DFRobot_SIM7000 sim7000;

void setup(){
int signalStrength,dataNum;
Serial.begin(115200);
while(!Serial);
sim7000.begin(mySerial);
Serial.println("Enter anything to get positioning ");
char loge[10];
readSerial(loge);
Serial.println(“Getting position…”);

Serial.println(“Turn ON SIM7000…”);
if(sim7000.turnON()){ //Turn ON SIM7000
Serial.println(“Turn ON !”);
}

Serial.println(“Set baud rate…”);
while(1){
if(sim7000.setBaudRate(19200)){ //Set SIM7000 baud rate from 115200 to 19200 reduce the baud rate to avoid distortion
Serial.println(“Set baud rate:19200”);
break;
}else{
Serial.println(“Faile to set baud rate”);
delay(100);
}
}

Serial.println(“Check SIM card…”);
if(sim7000.checkSIMStatus()){ //Check SIM card
Serial.println(“SIM card READY”);
}else{
Serial.println(“SIM card ERROR, Check if you h ave insert SIM card and restart SIM7000”);
while(1);
}
Serial.println(“Get signal quality…”);
signalStrength=sim7000.checkSignalQuality(); //Check signal quality from (0-30)
Serial.print(“signalStrength =”);
Serial.println(signalStrength);
delay(100);

Serial.println(“Init http…”);
while(1){
if(sim7000.httpInit(GPRS)){ //Init http service
Serial.println(“HTTP init !”);
break;
}else{
Serial.println(“Fail to init http”);
}
}

Serial.println(“Init positioning function…”);
while(1){
if(sim7000.initPos()){
Serial.println(“Positioning function initialized”);
break;
}else{
Serial.println(“Fail to init positioning function”);
delay(500);
}
}
}

void loop(){
Serial.println("Enter anything end with CRLF to get positioning “);
int signalStrength;
char loge[10];
readSerial(loge);
Serial.println(“Getting position…”);
if(sim7000.getPosition()){ //Get the current position
Serial.print(” Longitude : “);
Serial.println(sim7000.getLongitude()); //Get longitude
Serial.print(” Latitude : ");
Serial.println(sim7000.getLatitude()); //Get latitude

signalStrength=sim7000.checkSignalQuality(); //Check signal quality from (0-30)
Serial.print(“signalStrength =”);
Serial.println(signalStrength);
}else{
Serial.println(“Wrong data try again”);
}
}

int readSerial(char result){
int i = 0;
while(1){
while(Serial.available() > 0){
char inChar = Serial.read();
if(inChar == ‘\n’){
result = ‘\0’;

  • Serial.flush();*
  • return 0;*
  • }*
  • if(inChar != ‘\r’){*
    _ result = inChar;_
    * i++;*
    * }*
    * }*
    * }*
    }

Read “How To Use This Forum”

in particular, 7. If you are posting code or error messages, use “code” tags

This is what happens when you do not

 * Note  : If you use Mega please connect PIN8 PIN10 and set PIN_RX = 10
  *         The positioning function only available in outdoor
  */

#define PIN_TX     7

the error is evident in the code tags above