Easy IoT is a simplest IoT Solution presented by DFRobot
By perry.costa01
#29658
I have followed the steps of the wiki and have had to alter code due to certain parts not being found in the "DFRobot_SIM7000.h" the code is:
#include <Wire.h>
#include <DFRobot_SIM7000.h>

#define PIN_TX 0
#define PIN_RX 1
SoftwareSerial mySerial(PIN_RX,PIN_TX);
DFRobot_SIM7000 sim7000;
static char buff[350];

void setup(){
int signalStrength,dataNum;
Serial.begin(115200);
sim7000.begin(mySerial);
sim7000.turnOFF();
delay(5000);
Serial.println("Turn ON SIM7000......");
if(sim7000.turnON()){ //Turn ON SIM7000
Serial.println("Turn ON !");
}
Serial.println("Set baud rate......");
if(sim7000.setBaudRate(19200)){ //Set baud rate from 115200 to 19200
Serial.println("Set baud rate:19200");
}else{
Serial.println("Faile to set baud rate");
while(1);
}
Serial.println("Check SIM card......");
if(sim7000.checkSIMStatus()){ //Check SIM card
Serial.println("SIM card READY");
}else{
Serial.println("SIM card ERROR");
while(1);
}
delay(500);
Serial.println("Set net mod......");
if(sim7000.setNetMode(NB)){ //Set net mod NB-IOT
Serial.println("Set NB-IOT mode");
}else{
Serial.println("Fail to set mode");
}
Serial.println("Get signal quality......");
delay(500);
signalStrength=sim7000.checkSignalQuality(); //Check signal quality from (0-30)
Serial.print("signalStrength =");
Serial.println(signalStrength);
delay(500);
Serial.println("Attaching service......");
if(sim7000.attacthService()){ //Open the connection
Serial.println("Attach service");
}else{
Serial.println("Fail to Attach service");
while(1);
}
delay(200);
Serial.println("Connecting......");
if(sim7000.openNetwork(TCP,"www.hologram.io",80)){ //Start Up TCP or UDP Connection
Serial.println("Connect OK");
}else{
Serial.println("Fail to connect");
while(1);
}
sim7000.send("HEAD/HTTP/1.1\r\nHost:www.taobao.com\r\nConnection:keep-alive\r\n\r\n"); //Send Data Through TCP or UDP Connection
dataNum=sim7000.recv(buff,350,0); //Receive data
Serial.print("dataNum=");
Serial.println(dataNum);
Serial.println(buff);
delay(500);
if(sim7000.closeNetwork()){ //End the connection
Serial.println("Close connection");
}else{
Serial.println("Fail to close connection");
}
delay(2000);
sim7000.turnOFF(); //Turn OFF SIM7000
}

void loop() {
delay(1000);
}

The errors coming up are:
Arduino: 1.8.9 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `setup':

D:\data\My Documents\Arduino\sketch_may31a/sketch_may31a.ino:13: undefined reference to `DFRobot_SIMcore::begin(Stream&)'

D:\data\My Documents\Arduino\sketch_may31a/sketch_may31a.ino:14: undefined reference to `DFRobot_SIMcore::turnOFF()'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `turnON':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:232: undefined reference to `DFRobot_SIMcore::setRate(long)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:233: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:234: undefined reference to `DFRobot_SIMcore::turnOFF()'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:236: undefined reference to `DFRobot_SIMcore::setRate(long)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:237: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:238: undefined reference to `DFRobot_SIMcore::turnOFF()'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:248: undefined reference to `DFRobot_SIMcore::setRate(long)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:249: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:251: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:251: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:260: undefined reference to `DFRobot_SIMcore::setRate(long)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:261: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:263: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:263: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `setBaudRate':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:40: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:60: undefined reference to `DFRobot_SIMcore::setRate(long)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `checkSIMStatus':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:71: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:83: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `setNetMode':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:100: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:102: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `checkSignalQuality':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:176: undefined reference to `DFRobot_SIMcore::cleanBuffer(char*, int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:177: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:178: undefined reference to `DFRobot_SIMcore::readBuffer(char*, int, unsigned int, unsigned int)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `attacthService':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:129: undefined reference to `DFRobot_SIMcore::cleanBuffer(char*, int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:130: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:132: undefined reference to `DFRobot_SIMcore::readBuffer(char*, int, unsigned int, unsigned int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:141: undefined reference to `DFRobot_SIMcore::cleanBuffer(char*, int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:143: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:155: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:157: undefined reference to `DFRobot_SIMcore::readBuffer(char*, int, unsigned int, unsigned int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:165: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `openNetwork':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:198: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:199: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:200: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:202: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:203: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:217: undefined reference to `DFRobot_SIMcore::cleanBuffer(char*, int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:218: undefined reference to `DFRobot_SIMcore::readBuffer(char*, int, unsigned int, unsigned int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:216: undefined reference to `DFRobot_SIMcore::checkReadable()'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `send':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:292: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:293: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:294: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `recv':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:550: undefined reference to `DFRobot_SIMcore::cleanBuffer(char*, int)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:551: undefined reference to `DFRobot_SIMcore::readBuffer(char*, int, unsigned int, unsigned int)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `closeNetwork':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:601: undefined reference to `DFRobot_SIMcore::check_send_cmd(char const*, char const*)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `send':

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:295: undefined reference to `DFRobot_SIMcore::send_cmd(char const*)'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:297: undefined reference to `DFRobot_SIMcore::checkReadable()'

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.cpp:298: undefined reference to `DFRobot_SIMcore::readBuffer(char*, int, unsigned int, unsigned int)'

C:\Users\91968\AppData\Local\Temp\ccWXik24.ltrans0.ltrans.o: In function `setup':

D:\data\My Documents\Arduino\sketch_may31a/sketch_may31a.ino:74: undefined reference to `DFRobot_SIMcore::turnOFF()'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


If anyone would be able to give some help I would be very grateful :D
By nana.wang
#29663
Hi Perry,
Thanks for your support.
All these errors are related to library.
Could you please tell what you you have done to modify the library?
By perry.costa01
#29683
Hi,
I haven't altered library. I altered the code to fit it to the library. Which was only 3 changes:
Line 36, from setNet --> to setNetMode
Line 56, from connect --> to openNetwork
Line 68, from close --> to closeNetwork

That's all :/ if you run the code they aren't found in the file: DFRobot_SIM7000.h
But the altered forms are.
By perry.costa01
#29690
With the new library the errors are now:
Arduino: 1.8.9 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from d:\data\My Documents\Arduino\libraries\DFRobot_SIM-master/DFRobot_SIM.h:7:0,

from D:\data\My Documents\Arduino\sketch_may31a\sketch_may31a.ino:2:

d:\data\My Documents\Arduino\libraries\DFRobot_SIM-master/DFRobot_SIMclient.h:6:6: error: multiple definition of 'enum Protocol'

enum Protocol {

^

In file included from D:\data\My Documents\Arduino\sketch_may31a\sketch_may31a.ino:1:0:

d:\data\My Documents\Arduino\libraries\DFRobot_SIM7000-master/DFRobot_SIM7000.h:9:6: note: previous definition here

enum Protocol {

^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
By nana.wang
#29702
Hi, we have tested the same version but no problem.
Please confirm whether the library is the latest or try delete it and download again.
By andries.arenek
#40872
Good day,
I am having similar issues. Suspect it relates to the setNet vs setNetMode methods that are different in your example and library.

Code on your wiki at https://wiki.dfrobot.com/SIM7000_Arduin ... 05_DFR0572 refers to setNet method as per below:
Code: Select all
delay(500);
    Serial.println("Set net mod......");
    if(sim7000.setNet(NB)){                                                                    //Set net mod NB-IOT
        Serial.println("Set NB-IOT mode");
    }else{
        Serial.println("Fail to set mode");
    }
When looking at code on github at https://github.com/DFRobot/DFRobot_SIM7 ... IM7000.cpp, it refers to setNetMode
Code: Select all
bool  DFRobot_SIM7000::setNetMode(Net net)
{
    if(net == NB){
       mode_t=0;
Please can you advise?
AA
By nana.wang
#40892
Hi, sorry for inconvenience caused.
Thank you for your support and feedback.
The engineer is checking the wiki page and github library.
We will update it and feed you back ASAP.
By nana.wang
#40899
Thank you for your reminding.
The wiki is updated. And the GitHub library is alright.