i have 2 18B20 temp sensors ...
Found '1-Wire' device with address:
0x28, 0xC2, 0x39, 0x77, 0x03, 0x00, 0x00, 0x52
Found '1-Wire' device with address:
0x28, 0x3F, 0x2B, 0x77, 0x03, 0x00, 0x00, 0x95
1 HD74480 LCD and an arduino uno
i can make each of them work seperatly (lcd hello world and 18B20 read temp through serial monitor)
i cant get it to work together.
here is the code im using...
// This Arduino sketch reads DS18B20 "1-Wire" digital
// temperature sensors.
// Tutorial:
// Arduino 1-Wire Tutorial#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13; // pin 13 will control the backlight
// Data wire is plugged into pin 8 on the Arduino
#define ONE_WIRE_BUS 8// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// Arduino 1-Wire Address FinderDeviceAddress insideThermometer = { 0x28, 0xC2, 0x39, 0x77, 0x03, 0x00, 0x00, 0x52 };
DeviceAddress outsideThermometer = { 0x28, 0x3F, 0x2B, 0x77, 0x03, 0x00, 0x00, 0x95 };void setup(void)
{
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(insideThermometer, 10);
sensors.setResolution(outsideThermometer, 10);pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
}void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC();
if (tempC == -127.00) {
lcd.print("Error");
} else {
lcd.print(tempC);
lcd.print("/");
lcd.print(DallasTemperature::toFahrenheit(tempC));
}
}void loop(void)
{
delay(2000);
sensors.requestTemperatures();
lcd.setCursor(0,0);
lcd.print("In: ");
printTemperature(insideThermometer);
lcd.setCursor(0,1);
lcd.print("Out: ");
printTemperature(outsideThermometer);
}
this is the error im getting
sketch_oct13a:7: error: variable or field 'printTemperature' declared void
sketch_oct13a:7: error: 'DeviceAddress' was not declared in this scope
sketch_oct13a:20: error: no matching function for call to 'DallasTemperature::DallasTemperature(OneWire*)'
C:\Users\Chad\Downloads\arduino-0023\arduino-0023\libraries\DallasTemperature/DallasTemperature.h:48: note: candidates are: DallasTemperature::DallasTemperature(NewOneWire&, uint8_t, StratBase*)
C:\Users\Chad\Downloads\arduino-0023\arduino-0023\libraries\DallasTemperature/DallasTemperature.h:20: note: DallasTemperature::DallasTemperature(const DallasTemperature&)
sketch_oct13a:26: error: 'DeviceAddress' does not name a type
sketch_oct13a:27: error: 'DeviceAddress' does not name a type
sketch_oct13a.cpp: In function 'void setup()':
sketch_oct13a:34: error: 'class DallasTemperature' has no member named 'setResolution'
sketch_oct13a:34: error: 'insideThermometer' was not declared in this scope
sketch_oct13a:35: error: 'class DallasTemperature' has no member named 'setResolution'
sketch_oct13a:35: error: 'outsideThermometer' was not declared in this scope
sketch_oct13a.cpp: At global scope:
sketch_oct13a:43: error: variable or field 'printTemperature' declared void
sketch_oct13a:43: error: 'DeviceAddress' was not declared in this scope
any guidance is appreciated.
please dont do the " just use the search function of the forum" i already have as well as crawled all over the net searching before i posted.