I have a brand new Arduino MKR Zero. I want to use a Adafruit MAX31855 board to measure temperature but it won't compile the example code. I tried the example code on a MEGA and it works great so it isn't the board. The Zero is recognized fine in the IDE and I can compile a blank sketch so it works. So then I try just #include <SPI.h>
compiles fine.
then I try #include <SPI.h> #include "Adafruit_MAX31855.h"
and it fails with a long error screen. These are the first 2 lines in the Adafruit MAX31855 example code. So it definitely is the #include "Adafruit_MAX31855.h" line. I'm pretty sure the MKR Zero has a SPI input so that isn't an issue. Right now Idon't even have anything connected to the board yet. I just want it to compile.
the error message is very long but I can give you some of it. More if you need it.
In file included from C:\Users\jrkeme\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21.h:69:0,
from C:\Users\jrkeme\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0/CMSIS/Device/ATMEL/samd.h:105,
from C:\Users\jrkeme\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.14\cores\arduino/WVariant.h:22,
from C:\Users\jrkeme\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.14\variants\mkrzero/variant.h:24,
This goes on for a while. The first sign of an issue is later
In file included from C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392\Adafruit_I2CDevice.cpp:1:0:
C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392/Adafruit_I2CDevice.h:9:36: error: 'TwoWire' has not been declared
Adafruit_I2CDevice(uint8_t addr, TwoWire theWire = &Wire);
^~~~~~~
C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392/Adafruit_I2CDevice.h:28:3: error: 'TwoWire' does not name a type; did you mean 'TwoWire_h'?
TwoWire _wire;
^~~~~~~
TwoWire_h
C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392/Adafruit_I2CDevice.h:9:55: error: could not convert '& Wire' from 'arduino::TwoWire' to 'int'
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
no. but I will right now. Thanks.
I'm good enough with Arduino stuff but not when errors come up that I'm not familiar with. I've used I2C and SPI on other projects but the MKR Zero seems more finicky than the bulletproof Mega.
unfortunately it didn't work.
same error. the ending of the error message is a follows.
size_t recv = _wire->requestFrom((uint8_t)_addr, (uint8_t)len, (uint8_t)stop);
^~~~~
Wire
C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392\Adafruit_I2CDevice.cpp: In member function 'bool Adafruit_I2CDevice::setSpeed(uint32_t)':
C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392\Adafruit_I2CDevice.cpp:246:3: error: '_wire' was not declared in this scope
_wire->setClock(desiredclk);
^~~~~
C:\Users\jrkeme\Documents\Arduino\libraries\arduino_488392\Adafruit_I2CDevice.cpp:246:3: note: suggested alternative: 'Wire'
_wire->setClock(desiredclk);
^~~~~
Wire
exit status 1
Error compiling for board Arduino MKR Zero.
arduino-cli compile -b arduino:samd:mkrzero --warnings all --output-dir /home/me/tmp --no-color (in directory: /home/me/Documents/sketchbook/MKR_Zero/test)
Sketch uses 14104 bytes (5%) of program storage space. Maximum is 262144 bytes.
Global variables use 3068 bytes (9%) of dynamic memory, leaving 29700 bytes for local variables. Maximum is 32768 bytes.
Used library Version Path
SPI 1.0 /home/me/.arduino15/packages/arduino/hardware/samd/1.8.14/libraries/SPI
Adafruit MAX31855 library 1.4.2 /home/me/Documents/sketchbook/libraries/Adafruit_MAX31855_library
Adafruit BusIO 1.16.0 /home/me/Documents/sketchbook/libraries/Adafruit_BusIO
Wire 1.0 /home/me/.arduino15/packages/arduino/hardware/samd/1.8.14/libraries/Wire
Used platform Version Path
arduino:samd 1.8.14 /home/me/.arduino15/packages/arduino/hardware/samd/1.8.14
Compilation finished successfully.
OK. I tried a different PC. And it compiled OK. So it looks like it’s something wrong with my own PC. Thanks for the help guys. They are messages is so long and vague. I wasn’t sure what it was but it seems like somethings not installed right. Thanks again.