如何连接Arduino由于GPS模块?

时间:2018-03-27 15:56:55

标签: arduino gps arduino-due software-serial

我正在开发一个Arduino项目,我是Arduino的初学者,所以我开始从互联网上获取代码并尝试学习和理解它,

https://www.hackster.io/bigboystoys13/diymall-gprs-gps-sim5320e-3g-module-at-commands-d1cbfe

我尝试将此代码上传到到期板,因此软件序列库出现错误,这是错误:

    Arduino: 1.8.4 (Windows 10), Board: "Arduino Due (Programming Port)"

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:125:2: error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors

 #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors

  ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'bool SoftwareSerial::listen()':

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:181:23: error: 'SREG' was not declared in this scope

     uint8_t oldSREG = SREG;

                       ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:182:9: error: 'cli' was not declared in this scope

     cli();

         ^

In file included from C:\Users\Mahmoud Souayfan\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Arduino.h:201:0,

                 from C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:43:

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::setTX(uint8_t)':

C:\Users\Mahmoud Souayfan\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\variants\arduino_due_x/variant.h:63:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]

 #define digitalPinToPort(P)        ( g_APinDescription[P].pPort )

                                                                 ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:357:18: note: in expansion of macro 'digitalPinToPort'

   uint8_t port = digitalPinToPort(tx);

                  ^

C:\Users\Mahmoud Souayfan\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\variants\arduino_due_x/variant.h:66:44: error: base operand of '->' is not a pointer

 #define portOutputRegister(port)   ( &(port->PIO_ODSR) )

                                            ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:358:27: note: in expansion of macro 'portOutputRegister'

   _transmitPortRegister = portOutputRegister(port);

                           ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::setRX(uint8_t)':

C:\Users\Mahmoud Souayfan\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\variants\arduino_due_x/variant.h:63:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive]

 #define digitalPinToPort(P)        ( g_APinDescription[P].pPort )

                                                                 ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:368:18: note: in expansion of macro 'digitalPinToPort'

   uint8_t port = digitalPinToPort(rx);

                  ^

C:\Users\Mahmoud Souayfan\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer

 #define portInputRegister(port)    ( &(port->PIO_PDSR) )

                                            ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:369:26: note: in expansion of macro 'portInputRegister'

   _receivePortRegister = portInputRegister(port);

                          ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:380:31: error: 'table' was not declared in this scope

   for (unsigned i=0; i<sizeof(table)/sizeof(table[0]); ++i)

                               ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:396:38: error: 'digitalPinToPCICR' was not declared in this scope

     if (digitalPinToPCICR(_receivePin))

                                      ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:398:78: error: 'digitalPinToPCICRbit' was not declared in this scope

       *digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin));

                                                                              ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:398:79: error: '_BV' was not declared in this scope

       *digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin));

                                                                               ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:399:37: error: 'digitalPinToPCMSK' was not declared in this scope

       *digitalPinToPCMSK(_receivePin) |= _BV(digitalPinToPCMSKbit(_receivePin));

                                     ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:399:78: error: 'digitalPinToPCMSKbit' was not declared in this scope

       *digitalPinToPCMSK(_receivePin) |= _BV(digitalPinToPCMSKbit(_receivePin));

                                                                              ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:414:36: error: 'digitalPinToPCMSK' was not declared in this scope

   if (digitalPinToPCMSK(_receivePin))

                                    ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:415:77: error: 'digitalPinToPCMSKbit' was not declared in this scope

     *digitalPinToPCMSK(_receivePin) &= ~_BV(digitalPinToPCMSKbit(_receivePin));

                                                                             ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:415:78: error: '_BV' was not declared in this scope

     *digitalPinToPCMSK(_receivePin) &= ~_BV(digitalPinToPCMSKbit(_receivePin));

                                                                              ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)':

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:450:21: error: 'SREG' was not declared in this scope

   uint8_t oldSREG = SREG;

                     ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:451:7: error: 'cli' was not declared in this scope

   cli();  // turn off interrupts for a clean txmit

       ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:455:26: error: 'XMIT_START_ADJUSTMENT' was not declared in this scope

   tunedDelay(_tx_delay + XMIT_START_ADJUSTMENT);

                          ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual void SoftwareSerial::flush()':

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:498:21: error: 'SREG' was not declared in this scope

   uint8_t oldSREG = SREG;

                     ^

C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:499:7: error: 'cli' was not declared in this scope

   cli();

       ^

exit status 1
Error compiling for board Arduino Due (Programming Port).

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

1 个答案:

答案 0 :(得分:0)

也许你没有在arduino IDE中选择arduino的类型。 您需要在工具&gt;中选择条目。与您的Arduino到期或Genuino板或其他对应的板菜单。您还需要选择连接arduino的端口。 更多信息:https://www.arduino.cc/en/Guide/ArduinoDue