Compare commits
2 commits
bd366ad69b
...
7c12ac40f8
Author | SHA1 | Date | |
---|---|---|---|
7c12ac40f8 | |||
26f68b2b74 |
2 changed files with 1429 additions and 139 deletions
|
@ -1,10 +1,24 @@
|
|||
#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();
|
||||
|
@ -19,15 +33,53 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
//
|
||||
lcd.setCursor(6, 0);
|
||||
lcd.print("Nothing");
|
||||
lcd.setCursor(9, 1);
|
||||
lcd.print("to");
|
||||
lcd.setCursor(9, 2);
|
||||
lcd.print("do");
|
||||
lcd.setCursor(8, 3);
|
||||
lcd.print("jet.");
|
||||
settemp();
|
||||
readtemp();
|
||||
lcdoutput();
|
||||
|
||||
delay(100);
|
||||
|
||||
if (tempset >= watertemp) {
|
||||
digitalWrite(9, HIGH);
|
||||
|
||||
delay(1000000000);
|
||||
|
||||
}
|
||||
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(9, 1);
|
||||
lcd.print("t:");
|
||||
lcd.print(watertemp);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// 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