Some problems vith decleared values

Hi you all wizkids behind the screens, trying to compile this code to UNO but get some errors, is this due to that it is an old piece of code i found online, or is it really somthing wrong with it?
Code is originally from Dallas i think

Greatful for all help

Br

/ Andy

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2
#define TEMPERATURE_PRECISION 12

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// arrays to hold device addresses
DeviceAddress insideThermometer, outsideThermometer;

const int RELAY1 = 12;
float deltaT = 0;
float tempOutside = 0;
float tempBoiler = 0;
int defrostActive = 0; //Avfrostning aktiv
int defrostNeeded = 0; //Räknare behov
unsigned long timeStart = 0; //Avfrostning start
unsigned long timeRun = 0; //Avfrostning pågått

void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println(“Dallas Temperature IC Control Library Demo”);
pinMode (RELAY1, OUTPUT);

// Start up the library
sensors.begin();

// locate devices on the bus
Serial.print(“Locating devices…”);
Serial.print(“Found “);
Serial.print(sensors.getDeviceCount(), DEC);
Serial.println(” devices.”);

// report parasite power requirements
Serial.print("Parasite power is: ");
if (sensors.isParasitePowerMode()) Serial.println(“ON”);
else Serial.println(“OFF”);
if (!sensors.getAddress(insideThermometer, 0)) Serial.println(“Unable to find address for Device 0”);
if (!sensors.getAddress(outsideThermometer, 1)) Serial.println(“Unable to find address for Device 1”);
Serial.print("Device 0 Address: ");
printAddress(insideThermometer);
Serial.println();

Serial.print("Device 1 Address: ");
printAddress(outsideThermometer);
Serial.println();

// set the resolution to 9 bit per device
sensors.setResolution(insideThermometer, TEMPERATURE_PRECISION);
sensors.setResolution(outsideThermometer, TEMPERATURE_PRECISION);

Serial.print("Device 0 Resolution: ");
Serial.print(sensors.getResolution(insideThermometer), DEC);
Serial.println();

Serial.print("Device 1 Resolution: ");
Serial.print(sensors.getResolution(outsideThermometer), DEC);
Serial.println();
}

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
for (uint8_t i = 0; i < 8; i++)
{
// zero pad the address if necessary
if (deviceAddress < 16) Serial.print(“0”);
Serial.print(deviceAddress, HEX);
}
}

// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
Serial.print("Temp C: “);
Serial.print(tempC, 3);
//g Serial.print(” Temp F: ");
//g Serial.print(DallasTemperature::toFahrenheit(tempC));
}

// function to print a device’s resolution
void printResolution(DeviceAddress deviceAddress)
{
Serial.print("Resolution: ");
Serial.print(sensors.getResolution(deviceAddress));
Serial.println();
}

// main function to print information about a device
void printData(DeviceAddress deviceAddress)
{
Serial.print("Device Address: “);
printAddress(deviceAddress);
Serial.print(” ");
printTemperature(deviceAddress);
Serial.println();
}

void loop(void)
{
delay (3000);
sensors.requestTemperatures();
printData(insideThermometer);
printData(outsideThermometer);
tempOutside = sensors.getTempC(insideThermometer);
tempBoiler = sensors.getTempC(outsideThermometer);
deltaT = tempOutside - tempBoiler;
Serial.println (tempOutside, 3);
Serial.println (tempBoiler, 3);
Serial.println (deltaT, 3);
if ((deltaT > 6) && (tempBoiler < -3.5) && (defrostActive == 0)) {
defrostNeeded++;
Serial.println (“Räknar upp”);
}
else if (defrostNeeded > 0) {
defrostNeeded = 0 ; //nollställ räknare om behovet försvann
}
delay (2000);

Serial.println (defrostNeeded);
Serial.println (tempOutside, 3);
Serial.println (tempBoiler, 3);

if (defrostNeeded > 12 && defrostActive == 0) { //60 sek avfrostningsbehov före start
defrostActive = 1;
defrostNeeded = 0;
Serial.println (“Startar avfrostning”);
digitalWrite (RELAY1, HIGH);
timeStart = millis();
}

timeRun = millis() - timeStart;

if (defrostActive == 1) {
if (timeRun > 720000 || tempBoiler > 10) { //Pågått 12 min eller når 10 grader.
digitalWrite (RELAY1, LOW);
defrostActive = 0;
delay(1800000); //30 min fördröjnig efter avfrostning
}
}
}

Please post the "some errors". They usually contain a lot of useful information.

Steve

(deleted)

Place your bets now as to what the errors will be

My guess is "no such file or directory" for one or both of the libraries

Hi again, this is the results

Best regards
/A

Using board ‘uno’ from platform in folder: /home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23

Using core ‘arduino’ from platform in folder: /home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23

Detecting libraries used…

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp -o /dev/null

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard -I/home/builder/opt/libraries/latest/onewire_2_3_5 /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp -o /dev/null

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard -I/home/builder/opt/libraries/latest/onewire_2_3_5 -I/home/builder/opt/libraries/latest/dallastemperature_3_8_0 /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp -o /dev/null

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard -I/home/builder/opt/libraries/latest/onewire_2_3_5 -I/home/builder/opt/libraries/latest/dallastemperature_3_8_0 /home/builder/opt/libraries/latest/onewire_2_3_5/OneWire.cpp -o /dev/null

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard -I/home/builder/opt/libraries/latest/onewire_2_3_5 -I/home/builder/opt/libraries/latest/dallastemperature_3_8_0 /home/builder/opt/libraries/latest/dallastemperature_3_8_0/DallasTemperature.cpp -o /dev/null

Generating function prototypes…

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard -I/home/builder/opt/libraries/latest/onewire_2_3_5 -I/home/builder/opt/libraries/latest/dallastemperature_3_8_0 /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp -o /tmp/667312772/build/preproc/ctags_target_for_gcc_minus_e.cpp

/home/builder/opt/arduino-builder/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives /tmp/667312772/build/preproc/ctags_target_for_gcc_minus_e.cpp

Compiling sketch…

/home/builder/.arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino -I/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/variants/standard -I/home/builder/opt/libraries/latest/onewire_2_3_5 -I/home/builder/opt/libraries/latest/dallastemperature_3_8_0 /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp -o /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp.o

Multiple libraries were found for “OneWire.h”

Used: /home/builder/opt/libraries/latest/onewire_2_3_5

Not used: /home/builder/opt/libraries/latest/max31850_onewire_1_0_2

Multiple libraries were found for “DallasTemperature.h”

Used: /home/builder/opt/libraries/latest/dallastemperature_3_8_0

Not used: /home/builder/opt/libraries/latest/max31850_dallastemp_1_0_1

Using library onewire_2_3_5 at version 2.3.5 in folder: /home/builder/opt/libraries/latest/onewire_2_3_5

Using library dallastemperature_3_8_0 at version 3.8.0 in folder: /home/builder/opt/libraries/latest/dallastemperature_3_8_0

/tmp/667312772/sketch_nov2a_copy_tempsensor_ds18b20/sketch_nov2a_copy_tempsensor_ds18b20.ino: In function ‘void printAddress(uint8_t*)’:

/tmp/667312772/sketch_nov2a_copy_tempsensor_ds18b20/sketch_nov2a_copy_tempsensor_ds18b20.ino:80:36: error: no matching function for call to ‘print(uint8_t*&, int)’

Serial.print(deviceAddress, HEX);

^

In file included from /home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Stream.h:26:0,

from /home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/HardwareSerial.h:29,

from /home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Arduino.h:232,

from /tmp/667312772/build/sketch/sketch_nov2a_copy_tempsensor_ds18b20.ino.cpp:1:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:69:12: note: candidate: size_t Print::print(unsigned char, int)

size_t print(unsigned char, int = DEC);

^

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:69:12: note: conversion of argument 1 would be ill-formed:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:70:12: note: candidate: size_t Print::print(int, int)

size_t print(int, int = DEC);

^

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:70:12: note: conversion of argument 1 would be ill-formed:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:71:12: note: candidate: size_t Print::print(unsigned int, int)

size_t print(unsigned int, int = DEC);

^

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:71:12: note: conversion of argument 1 would be ill-formed:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:72:12: note: candidate: size_t Print::print(long int, int)

size_t print(long, int = DEC);

^

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:72:12: note: conversion of argument 1 would be ill-formed:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:73:12: note: candidate: size_t Print::print(long unsigned int, int)

size_t print(unsigned long, int = DEC);

^

/home/builder/.arduino15/packages/arduino/hardware/avr/1.6.23/cores/arduino/Print.h:73:12: note: conversion of argument 1 would be ill-formed:

exit status 1

a
Also says : no matching function for call to print (uint8_t … in this function
and highlighten the row where the xx:es are below
{
for (uint8_t i = 0; i < 8; i++)
{
// zero pad the address if necessary
if (deviceAddress < 16) Serial.print(“0”);
Serial.print(deviceAddress, HEX); XXXXXX
}
}

Your code

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
  for (uint8_t i = 0; i < 8; i++)
  {
    // zero pad the address if necessary
    if (deviceAddress < 16) Serial.print("0");
    Serial.print(deviceAddress, HEX);
  }
}

What I think is the original code from https://github.com/milesburton/Arduino-Temperature-Control-Library/blob/master/examples/Multiple/Multiple.pde

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
  for (uint8_t i = 0; i < 8; i++)
  {
    // zero pad the address if necessary
    if (deviceAddress[i] < 16) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);
  }
}

Spot the difference ?

If that is not the code that you copied then please post a link to it

Hi, i see the difference, and nope thats not the code i got, i got it from a forum discussing tempcontrol of a inverter and i thought it could come in handy to use as base for a temp relay driver..
Apperantly the code worked for them, but it was back in 2016, so my guess was that the code was old or something.. Since it probably worked for several guy´s in the past, is there something changed in the header files making the compilation stall???

BR
/A

willhelmx:
Hi, i see the difference, and nope thats not the code i got, i got it from a forum discussing tempcontrol of a inverter and i thought it could come in handy to use as base for a temp relay driver..

When you copied it, was part of it in italics?

Lack of code tags, strikes again.

Hi again - no, i just copied it via clipboard, but i will try and change the code according to the suggested... there seem to be some kind of data conversion going on here, not permitted by the system...
i´ll see what i can do

Thank you for all help so far :slight_smile:

( been 20 years ago with borland C++ ) so i have to re-learn som of the "quirks" :slight_smile:

BR
/A

Where exactly did you copy the code from ?

Hi again, got it working by some re-writing of the code problem with value conversion

Thank you for all help

BR

/A

The source was :Arduino till att styra avfrostning - Gör det själv - Värmepumpsforum allt om värmepump och värmepumpar

As suggested in post #8, part of the code that you copied was in italics because the array index ­[­i] was interpreted as an HTML italic tag so that the array access appeared to have no index value

As a matter of interest, how did you fix the problem ?