GSOE Belueftung DS18B20
Dependencies: LCD_i2c_GSOE DS1820
Revision 14:7d305c5c0364, committed 2020-10-30
- Comitter:
- jack1930
- Date:
- Fri Oct 30 11:36:49 2020 +0000
- Parent:
- 13:06a3997b1557
- Commit message:
- Belueftungssteuerung
Changed in this revision
LCD_i2c_GSOE.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_i2c_GSOE.lib Fri Oct 30 11:36:49 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/jack1930/code/LCD_i2c_GSOE/#3bac0faac335
--- a/main.cpp Mon Jul 20 08:10:43 2020 +0000 +++ b/main.cpp Fri Oct 30 11:36:49 2020 +0000 @@ -49,19 +49,41 @@ /*Several DS1820 sensors connected to the 1-wire bus:*/ #include "mbed.h" #include "DS1820.h" +#include "LCD.h" #define MAX_SENSOSRS 32 // max number of DS1820 sensors to be connected to the 1-wire bus (max 256) DS1820* ds1820[MAX_SENSOSRS]; Serial pc(USBTX, USBRX); DigitalOut led(LED1); -OneWire oneWire(D8); // substitute D8 with the actual pin name connected to the 1-wire bus +OneWire oneWire(PA_8); // substitute D8 with the actual pin name connected to the 1-wire bus int sensorsFound = 0; // counts the actually found DS1820 sensors + +lcd mylcd; +DigitalIn k0(PB_0); +DigitalOut abluft(PC_0); + +DigitalIn k1(PB_1); +DigitalOut rotinnen(PC_1); + +DigitalIn k2(PB_2); + +PwmOut zuluft(PC_6); +AnalogIn dreher(PA_0); + +PwmOut umluft1(PC_7); +PwmOut umluft2(PC_8); +PwmOut umluft3(PC_9); + + int main() { + k0.mode(PullDown); + k1.mode(PullDown); + k2.mode(PullDown); pc.printf("\r\n--Starting--\r\n"); - + mylcd.clear(); //Enumerate (i.e. detect) DS1820 sensors on the 1-wire bus for (sensorsFound = 0; sensorsFound < MAX_SENSOSRS; sensorsFound++) { ds1820[sensorsFound] = new DS1820(&oneWire); @@ -85,13 +107,32 @@ } while (1) { + mylcd.cursorpos(0); pc.printf("----------------\r\n"); for (int i = 0; i < sensorsFound; i++) ds1820[i]->startConversion(); // start temperature conversion from analog to digital ThisThread::sleep_for(1000); // let DS1820 sensors complete the temperature conversion for (int i = 0; i < sensorsFound; i++) { if (ds1820[i]->isPresent()) + { + mylcd.printf("temp[%d] = %3.1f%cC\r\n", i, ds1820[i]->read(), 176); // read temperature pc.printf("temp[%d] = %3.1f%cC\r\n", i, ds1820[i]->read(), 176); // read temperature + } } + abluft=k0; + + if (k2==1) zuluft.write(0.7); + else zuluft.write(0); + + rotinnen=k1; + + mylcd.cursorpos(0x40); + mylcd.printf("%d",(int)(dreher*4095)); + + float d=dreher; + umluft1=d; + umluft2=d; + umluft3=d; } + }