MLX90614 with SAMD21

Would like to use this well written, comprehensive MLX90614_Serial_Demo code with a SAMD21.

Code works perfect with an UNO but I cannot compile when selecting the SAMD board in the IDE.

I think this is an easy fix and has something to do with the different architectures but not being a C programmer I cannot correct the code.

Any help would be appreciated.

Ken

#include <Wire.h> // I2C library, required for MLX90614
#include <SparkFunMLX90614.h> // SparkFunMLX90614 Arduino library

IRTherm therm; // Create an IRTherm object to interact with throughout

const byte LED_PIN = 8; // Optional LED attached to pin 8 (active low)

void setup() 
{
  Serial.begin(9600); // Initialize Serial to log output
  therm.begin(); // Initialize thermal IR sensor
  therm.setUnit(TEMP_F); // Set the library's units to Farenheit
  // Alternatively, TEMP_F can be replaced with TEMP_C for Celsius or
  // TEMP_K for Kelvin.
  
  pinMode(LED_PIN, OUTPUT); // LED pin as output
  setLED(LOW); // LED OFF
}

void loop() 
{
  setLED(HIGH); //LED on
  
  // Call therm.read() to read object and ambient temperatures from the sensor.
  if (therm.read()) // On success, read() will return 1, on fail 0.
  {
    // Use the object() and ambient() functions to grab the object and ambient
 // temperatures.
 // They'll be floats, calculated out to the unit you set with setUnit().
    Serial.print("Object: " + String(therm.object(), 2));
    Serial.write('°'); // Degree Symbol
    Serial.println("F");
    Serial.print("Ambient: " + String(therm.ambient(), 2));
    Serial.write('°'); // Degree Symbol
    Serial.println("F");
    Serial.println();
  }
  setLED(LOW);
  delay(500);
}

void setLED(bool on)
{
  if (on)
    digitalWrite(LED_PIN, LOW);
  else
    digitalWrite(LED_PIN, HIGH);
}


SECTION OF SRC REFERRED TO IN ERROR:

uint8_t IRTherm::sleep(void)
{
	// Calculate a crc8 value.
	// Bits sent: _deviceAddress (shifted left 1) + 0xFF
	uint8_t crc = crc8(0, (_deviceAddress << 1));
	crc = crc8(crc, MLX90614_REGISTER_SLEEP);
	
	// Manually send the sleep command:
	Wire.beginTransmission(_deviceAddress);
	Wire.write(MLX90614_REGISTER_SLEEP);
	Wire.write(crc);
	Wire.endTransmission(true);
	
	// Set the SCL pin LOW, and SDA pin HIGH (should be pulled up)
	pinMode(SCL, OUTPUT);
	digitalWrite(SCL, LOW);
	pinMode(SDA, INPUT);
}

uint8_t IRTherm::wake(void)
{
	// Wake operation from datasheet. (Doesn't seem to be working.)
	pinMode(SCL, INPUT); // SCL high
	pinMode(SDA, OUTPUT);
	digitalWrite(SDA, LOW); // SDA low
	delay(50); // delay at least 33ms
	pinMode(SDA, INPUT); // SDA high
	delay(250);
	// PWM to SMBus mode:
	pinMode(SCL, OUTPUT);
	digitalWrite(SCL, LOW); // SCL low
	delay(10); // Delay at least 1.44ms
	pinMode(SCL, INPUT); // SCL high
	Wire.begin(); 
}



Arduino: 1.6.5 (Windows 8.1), Board: "Adafruit Feather M0 (Native USB Port)"

Build options changed, rebuilding all

C:\Users\kward\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp: In member function 'uint8_t IRTherm::sleep()':
C:\Users\kward\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp:276:10: error: 'SCL' was not declared in this scope
  pinMode(SCL, OUTPUT);
          ^
C:\Users\kward\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp:278:10: error: 'SDA' was not declared in this scope
  pinMode(SDA, INPUT);
          ^
C:\Users\kward\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp: In member function 'uint8_t IRTherm::wake()':
C:\Users\kward\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp:284:10: error: 'SCL' was not declared in this scope
  pinMode(SCL, INPUT); // SCL high
          ^
C:\Users\kward\Documents\Arduino\libraries\SparkFun_MLX90614_Arduino_Library-master\src\SparkFunMLX90614.cpp:285:10: error: 'SDA' was not declared in this scope
  pinMode(SDA, OUTPUT);
          ^
Error compiling.

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

I think this is an easy fix

Certainly is. Just fix all the compilation errors.

Since you didn't show them, I'll assume that you know what they mean and how to fix them.

I guess I was assuming someone knowledgeable about the 90614 sensor, and the code to run it on the SAMD, maybe from Sparkfun tech support or someone to download the library and compile It would see this and offer some suggestions.