Hi guys, sorry for the late response.
The error im getting from the photon seems to be the Red Flash Sos.
I did not found something that could be related to my problem.
Im using the code for scd30 air sensor from SparkFun, this is the code:
boolean SCD30::begin() //TwoWire &wirePort
{
Wire.begin();
//Check for device to respond correctly
if (beginMeasuring() == true) //Start continuous measurements
{
setMeasurementInterval(2); //2 seconds between measurements
setAutoSelfCalibration(true); //Enable auto-self-calibration
return (true);
}
return (false); //Something went wrong
}
boolean SCD30::beginMeasuring(uint16_t pressureOffset)
{
Serial.println("inside begin messuring");
return (sendCommand(COMMAND_CONTINUOUS_MEASUREMENT, pressureOffset));
}
boolean SCD30::beginMeasuring(void)
{
return (beginMeasuring(0));
}
void SCD30::setMeasurementInterval(uint16_t interval)
{
Serial.println("before send command call at setMeasurementInterval");
sendCommand(COMMAND_SET_MEASUREMENT_INTERVAL, interval);
Serial.println("after send command call at setMeasurementInterval");
}
void SCD30::setAutoSelfCalibration(boolean enable)
{
if (enable){
Serial.println("inside setAutoSelfCalibration before send 1");
sendCommand(COMMAND_AUTOMATIC_SELF_CALIBRATION, 1); //Activate continuous ASC
}
else{
Serial.println("inside setAutoSelfCalibration before send 2");
sendCommand(COMMAND_AUTOMATIC_SELF_CALIBRATION, 0); //Deactivate continuous ASC
}
}
boolean SCD30::sendCommand(uint16_t command, uint16_t arguments)
{
Serial.println("inside send command 1");
uint8_t data[2];
data[0] = arguments >> 8;
data[1] = arguments & 0xFF;
uint8_t crc = computeCRC8(data, 2); //Calc CRC on the arguments only, not the command
Serial.println("inside send command 2");
Wire.beginTransmission(SCD30_ADDRESS);
Wire.write(command >> 8); //MSB
Wire.write(command & 0xFF); //LSB
Wire.write(arguments >> 8); //MSB
Wire.write(arguments & 0xFF); //LSB
Wire.write(crc);
Serial.println("inside send command 3");
if (Wire.endTransmission() != 0){
Serial.println("inside send command 4");
return (false); //Sensor did not ACK
}
Serial.println("inside send command 5");
return (true);
}
Output of Serial prints:
inside begin messuring
inside send command 1
inside send command 2
inside send command 3
inside send command 5
before send command call at setMeasurementInterval
inside send command 1
inside send command 2
inside send command 3
inside send command 5
after send command call at setMeasurementInterval
inside setAutoSelfCalibration before send 1
inside send command 1
inside send command 2
inside send command 3
It crashes always at the same place..
Thank you all very much for the help!