Hi! I'm new to Arduino (and programming in general). I'm currently working on how to connect a DS18B20 to a Moteino. I can't understand why but the category "sensor" isn't valid in the DallasTemperature library. I have tried uninstalling and re-installing it but I continue getting the same result.
I'm sorry if this question seems unintelligent, but I'm just starting out and would appreciate any help!
Here is my code:
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 14
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire
oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
}
void loop(void)
{
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
Serial.print("Temperature for Device 1 is: ");
Serial.print(sensors.getTempCByIndex(0)); //
}
I'm sorry if this question seems unintelligent, but I'm just starting out and would appreciate any help!
Here is my code:
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 14
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire
oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
}
void loop(void)
{
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
Serial.print("Temperature for Device 1 is: ");
Serial.print(sensors.getTempCByIndex(0)); //
}