some basic work implemented
This commit is contained in:
parent
efee152c5c
commit
cbbf0b77e7
1 changed files with 37 additions and 7 deletions
|
@ -1,21 +1,51 @@
|
||||||
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "hardware/i2c.h"
|
#include "hardware/i2c.h"
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
|
|
||||||
#include "lcd.h"
|
|
||||||
#include "ds18b20.h"
|
#include "ds18b20.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
|
||||||
constexpr uint I2C_SDA_PIN = 26;
|
constexpr uint I2C_SDA_PIN = 26;
|
||||||
constexpr uint I2C_SCL_PIN = 27;
|
constexpr uint I2C_SCL_PIN = 27;
|
||||||
|
constexpr uint DS18B20_PIN = 28;
|
||||||
|
|
||||||
|
constexpr char CUSTOM_CHAR_DEG = 0xDF;
|
||||||
|
constexpr char CUSTOM_CHAR_AE = 0xE1;
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
// Enable UART so we can print status output
|
// Enable UART so we can print status output
|
||||||
stdio_init_all();
|
stdio_init_all();
|
||||||
|
|
||||||
auto myLCD = LCD(i2c1, I2C_SDA_PIN, I2C_SCL_PIN);
|
auto myLCD = LCD(i2c1, I2C_SDA_PIN, I2C_SCL_PIN);
|
||||||
|
myLCD.clear();
|
||||||
|
|
||||||
myLCD.sendString("Hallo, Welt");
|
// DS18B20 ds = DS18B20(pio0, DS18B20_PIN);
|
||||||
myLCD.clear();
|
|
||||||
myLCD.sendString("Hallo, Wölt!");
|
float temp_act{0};
|
||||||
|
float temp_tgt{28.0};
|
||||||
|
std::stringstream lcdText{};
|
||||||
|
bool isHeating = false;
|
||||||
|
string heatInfo{" "};
|
||||||
|
string systemInfo{"OFF"};
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
// ds.convert();
|
||||||
|
sleep_ms(750);
|
||||||
|
// temp_act = ds.getTemperature();
|
||||||
|
temp_act = 23.5;
|
||||||
|
|
||||||
|
lcdText.str("");
|
||||||
|
lcdText.clear();
|
||||||
|
lcdText.precision(4);
|
||||||
|
lcdText << "ACT: " << temp_act << CUSTOM_CHAR_DEG << "C " << heatInfo << "\n"
|
||||||
|
<< "TGT: " << temp_tgt << CUSTOM_CHAR_DEG << "C " << systemInfo;
|
||||||
|
|
||||||
|
myLCD.setCursor(0, 0);
|
||||||
|
myLCD.sendString(lcdText.str());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue