12-03-2017, 14:53
Dzięki namok (szkoda że nie napisałeś że pomyliłem te dwie funkcje) ważne że działa wyświetlenie wszystkich 3 czujników
Teraz dodanie regulatora temperatury na przekaźniki
Kod PHP:
#include <LiquidCrystal_I2C.h>
#include <Wire.h> //
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DS18B20.h>
#include "max6675.h"
//Definicje, definicje:
#define SO_PIN 2 // 6675 Serial Output
#define CS_PIN 3 // 6675 Chip Select
#define CK_PIN 4 // 6675 Clock Pin
#define TOO_HOT 75.0 // To try limit calculation
#define TOO_COLD 62.5
MAX6675 thermocouple(CK_PIN, CS_PIN, SO_PIN);
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
OneWire oneWire(7); //Podłączenie do 7
DallasTemperature sensors(&oneWire); //Przekazania informacji do biblioteki
float DegreesC;
DeviceAddress a = { 0x28, 0xFF, 0x6E, 0xE5, 0x33, 0x16, 0x4, 0x2E };
DeviceAddress b = { 0x28, 0xFF, 0x3, 0xE7, 0x33, 0x16, 0x4, 0xD4 };
void setup(void) {
sensors.requestTemperatures(); //Pobranie temperatury czujnika
Serial.print("Woda: ");
Serial.println(sensors.getTempCByIndex(0)); //Wyswietlenie informacji
Serial.print("Powietrze: ");
Serial.println(sensors.getTempCByIndex(1)); //Wyswietlenie informacji
Serial.print("Czopuch: ");
Serial.println(DegreesC);
DegreesC=(thermocouple.readCelsius());
sensors.begin();
lcd.begin(16,2);
lcd.backlight();
lcd.clear();
lcd.setCursor(0,0);
}
void loop(void) {
lcd.setCursor(0,0);
lcd.print("W=");
lcd.print(sensors.getTempCByIndex(0));
lcd.setCursor(0,1);
lcd.print("P=");
lcd.print(sensors.getTempCByIndex(1));
lcd.setCursor(8,1);
lcd.print("C=");
lcd.print(DegreesC);
}