Compare commits
No commits in common. "7c12ac40f84360a5181f87a76daf74f700fc88fe" and "bd366ad69b904b3e97aa151aa4c21e9de2a14727" have entirely different histories.
7c12ac40f8
...
bd366ad69b
2 changed files with 135 additions and 1425 deletions
|
@ -1,24 +1,10 @@
|
|||
#include <Wire.h> // Support for I2C --> LCD
|
||||
#include <LiquidCrystal_I2C.h> // Support for PCF8574 --> LCD
|
||||
#include <OneWire.h> // 1-Wiresupport for DS18B20
|
||||
#include <DallasTemperature.h> // Easy reading of DS18B20
|
||||
|
||||
#define ONE_WIRE_BUS 10 // Enable 1-Wirebus on digital 10 (PB2 - Pin16)
|
||||
|
||||
LiquidCrystal_I2C lcd(0x3F,20,4); // declare LCD
|
||||
OneWire oneWire(ONE_WIRE_BUS); // declare 1-Wirebus
|
||||
DallasTemperature sensors(&oneWire); // declare sensors
|
||||
|
||||
float tempset;
|
||||
float watertemp;
|
||||
int poti;
|
||||
|
||||
void setup() {
|
||||
// Setup GPIO
|
||||
pinMode(9, OUTPUT); // Output "Wecktopf"
|
||||
pinMode(8, OUTPUT); // Fan
|
||||
// Setup sensors
|
||||
sensors.begin();
|
||||
|
||||
// Setup I2C-LCD
|
||||
lcd.init();
|
||||
lcd.backlight();
|
||||
|
@ -33,53 +19,15 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
//
|
||||
settemp();
|
||||
readtemp();
|
||||
lcdoutput();
|
||||
|
||||
delay(100);
|
||||
|
||||
if (tempset >= watertemp) {
|
||||
digitalWrite(9, HIGH);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
digitalWrite(9, LOW);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// Read temp from DS18B20
|
||||
void readtemp() {
|
||||
|
||||
/* Read temp of first sensor and take if for watertemp.
|
||||
* In future we might add others.
|
||||
*/
|
||||
sensors.requestTemperatures();
|
||||
watertemp = sensors.getTempCByIndex(0);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// LCD output
|
||||
void lcdoutput() {
|
||||
// Output temperatureset
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("s:");
|
||||
lcd.print(tempset);
|
||||
|
||||
// Output watertemp
|
||||
lcd.setCursor(6, 0);
|
||||
lcd.print("Nothing");
|
||||
lcd.setCursor(9, 1);
|
||||
lcd.print("t:");
|
||||
lcd.print(watertemp);
|
||||
}
|
||||
lcd.print("to");
|
||||
lcd.setCursor(9, 2);
|
||||
lcd.print("do");
|
||||
lcd.setCursor(8, 3);
|
||||
lcd.print("jet.");
|
||||
|
||||
delay(1000000000);
|
||||
|
||||
//------------------------------------------
|
||||
// Read Poti
|
||||
void settemp() {
|
||||
poti = analogRead(A3);
|
||||
tempset = (poti*0.1);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue