Hi,
I’m trying to compile this example but there is an error that I could not fix.
Does anybody knows what’s happen
Thank’s I’m desperate
error:/workspace/lib/spark-dallas-temperature/src/spark-dallas-temperature.h:27:36: fatal error: …/OneWire/OneWire.h: No such file or directory
#include “…/OneWire/OneWire.h”
code:
// This #include statement was automatically added by the Particle IDE.
#include <spark-dallas-temperature.h>
// This #include statement was automatically added by the Particle IDE.
#include <OneWire.h>
int oneWirePins[]={D4,D5};
const int oneWirePinsCount
=sizeof(oneWirePins)/sizeof(int);
OneWire ds18x20[oneWirePinsCount] { D4, D5 };
DallasTemperature sensor[oneWirePinsCount] { &ds18x20[0], &ds18x20[1] };
void setup() {
Serial.begin(9600);
Serial.print("============Ready with ");
Serial.print(oneWirePinsCount);
Serial.println(" Sensors================");
//Start up the library on all defined pins
DeviceAddress deviceAddress;
for (int i=0; i<oneWirePinsCount; i++) {;
//ds18x20[i].setPin(oneWirePins[i]);
//sensor[i].setOneWire(&ds18x20[i]);
sensor[i].begin();
if (sensor[i].getAddress(deviceAddress, 0))
sensor[i].setResolution(deviceAddress, 12);
}
void loop(void) {
Serial.print("Requesting temperatures...");
for (int i=0; i<oneWirePinsCount; i++) {
sensor[i].requestTemperatures();
}
Serial.println("DONE");
delay(1000);
for (int i=0; i<oneWirePinsCount; i++) {
float temperature=sensor[i].getTempCByIndex(0);
Serial.print("Temperature for the sensor ");
Serial.print(i);
Serial.print(" is ");
Serial.println(temperature);
}
Serial.println();
}