Hi, I am working on a project using the TinyZero board with the TinyShield Combo Sensor which includes the Temperature & humidity sensor SI7021.
Currently I am just playing around with the following code:
#include <Wire.h>
#include <SI7021.h>
SI7021 sensor;
// Make Serial Monitor compatible for all TinyCircuits processors
#if defined(ARDUINO_ARCH_AVR)
#define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
#define SerialMonitorInterface SerialUSB
#endif
void setup() {
SerialMonitorInterface.begin(115200);
Wire.begin();
SerialMonitorInterface.print("Initializing sensor... ");
if(!sensor.begin()){
SerialMonitorInterface.println("Sensor not found!");
while(true);
}
SerialMonitorInterface.println("Success!");
// this driver should work for SI7020 and SI7021, this returns 20 or 21
int deviceid = sensor.getDeviceId();
// SerialMonitorInterface.println(deviceid);
}
void loop() {
// read and print temp and humidity
float temperature = sensor.getCelsiusHundredths() / 100.0;
SerialMonitorInterface.print(temperature);
SerialMonitorInterface.print(" deg Celsius\t");
int humidity = sensor.getHumidityPercent();
SerialMonitorInterface.print(humidity);
SerialMonitorInterface.println("% relative humidity");
// enable internal heater for testing
sensor.setHeater(true);
delay(30000);
sensor.setHeater(false);
// see if heater changed temperature
// read and print temp and humidity
temperature = sensor.getCelsiusHundredths() / 100.0;
SerialMonitorInterface.print(temperature);
SerialMonitorInterface.print(" deg Celsius\t");
humidity = sensor.getHumidityPercent();
SerialMonitorInterface.print(humidity);
SerialMonitorInterface.println("% relative humidity -- (after heater on)");
//cool down
delay(30000);
// get humidity and temperature in one shot, saves power because sensor takes temperature when doing humidity anyway
// si7021_env data = sensor.getHumidityAndTemperature();
// delay(5000);
}
When I click on the "upload" button, I receive the following error message:
In file included from /Users/migueljauregui/Documents/Arduino/temp_humedad/temp_humedad.ino:2:0:
/Users/migueljauregui/Documents/Arduino/libraries/SI7021-master/SI7021.h:26:12: fatal error: pgmspace.h: No such file or directory
#include <pgmspace.h>
^~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
I do not know how to solve this issue, any help would be really appreciated.
Thanks,
Mike