Lots of errors when trying to compile example sketch
i have wired a gateway node with an NRF2401+ radio and a W5100 ethernet module and an Arduino nano. Pretty much like the tutorial.
So now i want to flash the arduino. I have downloaded the 2.0.0 library and imported the zipfile as a library in the Arduino software. I have copy&pasted the example sketch for this type of gateway, and tried to compile it. But i get LOTS of errors according to code in the library itself. Let me show you:
In file included from /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp:23:0, from /Users/simonszu/Documents/Arduino/libraries/MySensors-master/MySensors.h:261, from /Volumes/simonszu's home/MySensors/gateway/gateway.ino:117: /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.h:34:31: error: 'SPI_MODE0' was not declared in this scope #define MY_RF24_SPI_DATA_MODE SPI_MODE0 ^ /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.h:38:76: note: in expansion of macro 'MY_RF24_SPI_DATA_MODE' SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, MY_RF24_SPI_DATA_MODE> _SPI; ^ /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.h:38:97: error: template argument 4 is invalid SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, MY_RF24_SPI_DATA_MODE> _SPI; ^ /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.h:38:103: error: invalid type in declaration before ';' token SoftSPI<MY_SOFT_SPI_MISO_PIN, MY_SOFT_SPI_MOSI_PIN, MY_SOFT_SPI_SCK_PIN, MY_RF24_SPI_DATA_MODE> _SPI; ^ In file included from /Users/simonszu/Documents/Arduino/libraries/MySensors-master/MySensors.h:261:0, from /Volumes/simonszu's home/MySensors/gateway/gateway.ino:117: /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp: In function 'uint8_t RF24_spiMultiByteTransfer(uint8_t, uint8_t*, uint8_t, bool)': /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp:44:24: error: request for member 'transfer' in '_SPI', which is of non-class type 'int' uint8_t status = _SPI.transfer( cmd ); ^ /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp:47:18: error: request for member 'transfer' in '_SPI', which is of non-class type 'int' status = _SPI.transfer( NOP ); ^ /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp:49:24: error: request for member 'transfer' in '_SPI', which is of non-class type 'int' } else status = _SPI.transfer(*current++); ^ /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp: In function 'bool RF24_initialize()': /Users/simonszu/Documents/Arduino/libraries/MySensors-master/drivers/RF24/RF24.cpp:261:7: error: request for member 'begin' in '_SPI', which is of non-class type 'int' _SPI.begin(); ^ exit status 1 Error compiling for board Arduino Nano.
So my question is now: How can i resolve these issues? I am quite sure that you didn't commit faulty code, so it's somehow an error on my side...but where am i wrong?
@simonszu on my mobile now so I have trouble reading everything but try changing name of the Mysensors-master folder to just MySensors
The easiest way to install the MySensors library is to use the Board Manager. See https://www.mysensors.org/about/arduino#installing-the-sensor-libraries for instructions. You'll need to delete the folder that was added manually first though.