Hi !
Finaly i write code for 3 ds18b20 and one dht22 sensor web server, but i have a message :
exit status 1
call of overloaded 'print(DeviceAddress)' is ambiguous
my code is here:
koda ok1.txt (5.58 KB)
Hi !
Finaly i write code for 3 ds18b20 and one dht22 sensor web server, but i have a message :
exit status 1
call of overloaded 'print(DeviceAddress)' is ambiguous
my code is here:
koda ok1.txt (5.58 KB)
error is in "client.print(Thermometer3);"
( red colored when verify )
How is the device address useful information for the client?
DeviceAddress is an array of bytes. You can't print an array just by calling print() once. You need to print each element of the array.
I do not understand. Can you tell me what I need to change?
Can you tell me what I need to change?
Sure. You need to change the client.print(Thermometer3); statement.
You have to print each of the bytes of the address individually, using a for loop.
Can you please write an example, I am completely new to arduinu and I can not find a case of multiple sensors to the web server
Can you please write an example, I am completely new to arduinu and I can not find a case of multiple sensors to the web server
for(byte b=0; b<8; b++)
{
client.print(Thermometer3[b]);
}
Though I still can not imagine what use the address is going to be, on the browser.
You have 3 temperature sensors. I would expect to see 3 temperatures, not three addresses, on the web page.
Actually, it appears that you have 4 temperature sensors, one DHT type and 3 DallasTemperature type, and are sending the temperature read from the DHT type, and the addresses of the DallasTemperature type, to the client. Like I said, I can not imagine why.
hmmmm....now somthing work . ![]()
now i have i web page this:
Podatki o senzorjih DS18B20:
Senzor 1:40732353000128246°C
Senzor 2: 4025571163113225236°C
Senzor 3: 4012519530001281°C
Podatki o senzorju DHT22:
DHT22 Temperatura: 22.80°C
DHT22 Vlaga: 34.60 %
I need temperature ....
thankyou for your help....
I need temperature ....
Really, what a surprise.
Perhaps you ought to ask the sensors object for the temperature of the device with one of the addresses (well, all three of them, actually, but only one at a time), and send THAT information, instead of the address of the sensor.
and what i need to change now ?
Can you please write an example to view on my web page temperature for 3 ds18b20 sensors and 1 DHT22
Sorry for my hassle....
On serial monitor i see all temperatures
You've changed your code (or should have). You have not posted your current code.
You should be reading the three DallasTemperature sensors ONCE. You should be writing the stored temperatures to the SD card, to the LCD and to the serial monitor.
Now I have managed to change the code to run on a web page. ![]()
I had to delete the controls for display on the serial monitor
It does not work to me on a serial monitor. >:(
Can anyone help me to sign something to see on the serial monitor and the web ?
I use the Server PRTG network monitor and work great!
WORK ON WEB PAGE but not see senzor 1-3 in serial monitor. ( because i deleted )
#include <DHT.h>
#define DHTPIN 3 // connecting DHT sensor pin to pin 2 on our Arduino
#define DHTTYPE DHT22 // we are using DHT sensor 22
DHT dht(DHTPIN, DHTTYPE);
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#define ONE_WIRE_BUS 2 //definiramo pin, na katerega so priklučeni senzorju DS18B20
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress Thermometer1 = { 0x28, 0x80, 0xD3, 0x1E, 0x00, 0x00, 0x80, 0x45 };//ok
DeviceAddress Thermometer2 = { 0x28, 0xFF, 0x47, 0xA3, 0x71, 0x16, 0x05, 0xEC };//ok
DeviceAddress Thermometer3 = { 0x28, 0xB1, 0xEE, 0x1E, 0x00, 0x00, 0x080, 0xF7 };//ok
LiquidCrystal lcd(3, 4, 5, 6, 7, 8); //the pins used for the lcd display
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEC }; //mac address of ethernet shield
IPAddress ip(192,168,5,90); // ip address of ethernet shield
EthernetServer server(80); //sets the port for the ethernet shield- eg: port 80 http
void setup() {
Serial.begin(9600);
lcd.begin(16, 2); // change this back to 16, 2
dht.begin();
Ethernet.begin(mac, ip);
server.begin();
Serial.print("Server address:"); //prints server address to serial connection
Serial.println(Ethernet.localIP());
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(t) || isnan(h)) {
Serial.println("Count not detect sensor");
} else { //prints sensor output to lcd and serial monitor
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.setCursor(10, 0);
lcd.print(t);
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.setCursor(10, 1);
lcd.print(h);
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
}
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
boolean blankLine = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
if (c == '\n' && blankLine) { //initializing HTTP
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<center>");
client.println("<H1>");
client.println("Current Readings:");
client.println("</H1>");
client.println("<H2>");
client.println("Temperature: ");
client.println("</H2>");
client.println("<H1>");
client.print("[");
client.print(t);
client.println("] °");
client.println("C");
client.println("</H1>");
client.println("
");
client.println("<H2>");
client.println("Humidity: ");
client.println("</H2>");
client.println("<p />");
client.println("<H1>");
client.print("[");
client.print(h);
client.print("] %\t");
client.println("</H1>");
client.println("<p />");
client.println("</center>");
client.println("</html>");
sensors.requestTemperatures(); //Get temperature of all sensors
client.print ("<font color=black size=7>");
client.println("
");
client.print ("<font color=black size=7>");
client.print("Senzor 1: ");
client.print("[");
client.print(sensors.getTempC(Thermometer1)); //print temperature from DS18x20 sensor
client.println("] °");
client.println("C");
client.print ("<font color=green size=7>");
client.print ("<font color=black size=7>");
client.println("
");
client.print ("<font color=black size=7>");
client.print("Senzor 2: ");
client.print("[");
client.print(sensors.getTempC(Thermometer2)); //print temperature from DS18x20 sensor
client.println("] °");
client.println("C");
client.print ("<font color=green size=7>");
client.print ("<font color=black size=7>");
client.println("
");
client.print ("<font color=black size=7>");
client.print("Senzor 3: ");
client.print("[");
client.print(sensors.getTempC(Thermometer3)); //print temperature from DS18x20 sensor
client.println("] °");
client.println("C");
client.print ("<font color=green size=7>");
break;
}
if (c == '\n') {
blankLine = true;
}
else if (c != '\r') {
blankLine = false;
}
}
}
delay(1);
client.stop();
Serial.println("Disonnected");
}
}
NOT WORK ( exit status 1
call of overloaded 'print(DeviceAddress)' is ambiguous )
#include <OneWire.h>
#include <DallasTemperature.h>
#include "DHT.h"
#include <Wire.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //mac address of ethernet shield
IPAddress ip(192,168,5,90); // ip address of ethernet shield
EthernetServer server(80); //sets the port for the ethernet shield- eg: port 80 http
#define ONE_WIRE_BUS 2 //definiramo pin, na katerega so priklučeni senzorju DS18B20
#define DHTPIN 3
#define DHTTYPE DHT21
DHT dht(DHTPIN, DHTTYPE);
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress Thermometer1 = { 0x28, 0x49, 0xEB, 0x1E, 0x00, 0x00, 0x80, 0xF6 };
DeviceAddress Thermometer2 = { 0x28, 0xFF, 0x47, 0xA3, 0x71, 0x16, 0x05, 0xEC };
DeviceAddress Thermometer3 = { 0x28, 0x7D, 0xC3, 0x1E, 0x00, 0x00, 0x80, 0x01 };
void setup(void)
{
Serial.begin(9600); //zaženemo komunikacijo
sensors.begin(); //zaženemo knjižnico
sensors.setResolution(Thermometer1, 10); //nastavimo resolucijo na 10 bitov
sensors.setResolution(Thermometer2, 10);
sensors.setResolution(Thermometer3, 10);
Serial.print("Server address:"); //prints server address to serial connection
Serial.println(Ethernet.localIP());
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Napaka pri pridobivanju temperature");
} else {
Serial.print(tempC);
}
}
void loop() {
delay(5000);
float t = dht.readTemperature();
float h = dht.readHumidity();
Serial.print("Podatki o temperaturah.... \n\r");
sensors.requestTemperatures();
Serial.print("Temoeratura1 je: ");
printTemperature(Thermometer1);
Serial.print((char)176);
Serial.print("C ");
Serial.print("\n\r");
Serial.print("Temperatura2 je: ");
printTemperature(Thermometer2);
Serial.print((char)176);
Serial.print("C ");
Serial.print("\n\r");
Serial.print("Temperatura3 je: ");
printTemperature(Thermometer3);
Serial.print((char)176);
Serial.print("C ");
Serial.print("\n\r\n\r");
Serial.print("Temperatura okolice: ");
if (isnan(h) || isnan(t)) {
Serial.println("Napaka pri branju podatkov DHT22 senzorja!");
return;
}
Serial.print(t);
Serial.print((char)176);
Serial.print("C ");
Serial.print("\n\r");
Serial.print("Vlaznost zraka: ");
Serial.print(h);
Serial.print(" %");
Serial.print("\n\r");
Serial.print("---------------------------------- ");
Serial.print("\n\r\n\r");
EthernetClient client = server.available();
if (client) {
while (client.connected()){
if (client.available()) {
char c = client.read();
{
client.print ("<body sytle=background-color:yallow>");
client.print ("font color=red size=7>SPLETNO SPREMLJANJE TEMPERATUR");
client.println("
");
client.println("
");
client.print ("<font color=blue size=7>Podatki o senzorjih DS18B20:");
client.println("
");
client.print ("<font color=black size=7>Senzor 1:");
client.print ("<font color=green size=7>");
client.print(Thermometer1);
client.print ("<font color=black size=7>");
client.print((char)176);
client.print("C");
client.println("
");
client.print ("<font color=black size=7>");
client.print("Senzor 2: ");
client.print ("<font color=green size=7>");
client.print(Thermometer2);
client.print ("<font color=black size=7>");
client.print((char)176);
client.print("C");
client.println("
");
client.print ("<font color=black size=7>");
client.print("Senzor 3: ");
client.print ("<font color=green size=7>");
client.print(Thermometer3);
client.print ("<font color=black size=7>");
client.print((char)176);
client.print("C");
client.println("
");
client.println("
");
client.print ("<font color=black size=7>");
client.print ("<font color=blue size=7>Podatki o senzorju DHT22:");
client.println("
");
client.print ("<font color=black size=7>");
client.print("DHT22 Temperatura: ");
client.print ("<font color=green size=7>");
float t = dht.readTemperature();
client.print(t);
client.print ("<font color=black size=7>");
client.print((char)176);
client.print("C");
client.println("
");
client.print("DHT22 Vlaga: ");
client.print ("<font color=green size=7>");
float h = dht.readHumidity();
client.print(h);
client.print ("<font color=black size=7>");
client.print(" %");
break;
}
if (c == '\n') {
blankLine = true;
}
else if (c != '\r') {
blankLine = false;
}
}
}
delay(1);
client.stop();
Serial.println("Disonnected");
}
}
thankyou!
client.print(sensors.getTempC(Thermometer1)); //print temperature from DS18x20 sensor
Why? If you are going to continue ignoring my advice to get all the sensor data OUTSIDE of whether there is a client request, or not, ONCE, then I'm going to stop replying.
float temp1 = sensors.getTempC(Thermometer1);
.
.
.
Serial.print("Temperature 1: ");
Serial.println(temp1);
.
.
.
lcd.print("Temperature 1: ");
lcd.print(temp1);
.
.
.
client.print("Temperature 1: ");
client.println(temp1);
client.print(Thermometer1);
Once again, you are foolishly trying to deal with the ADDRESS of the sensor, NOT the DATA from the sensor.
Paul, thankyou again........ ![]()
Now work on web page and in serial monitor!
![]()
Im very happy ! ![]()