STM32F103C8T6_WIFI_Heating_system
Dependencies: mbed mbed-STM32F103C8T6 eeprom_flash Watchdog PinDetect DS1820
- Bluepill STM32F103C8T6 Heating system
- _This project is core part of bigger heating system project!_
Features
- Reading temperature from four DS18B20 sensors
- Making a decision about switching on/off heater and pomp
- Executing simple user commands from UART
- Storing state parameters to program memory (EEPROM emulation)
Diff: main.cpp
- Revision:
- 48:4ec055c066b4
- Parent:
- 47:4a955f381a1e
- Child:
- 50:94730b99ea41
--- a/main.cpp Sun Sep 23 17:00:19 2018 +0000 +++ b/main.cpp Sun Sep 23 18:54:12 2018 +0000 @@ -53,15 +53,25 @@ }; }; +void blink_myled(char amount) { + while (amount > 0) { + myled = 0; + wait(0.1); + myled = 1; + wait(0.2); + amount--; + }; +}; void pb_hit_interrupt (void) { //writeEEPROMWord(0, 666 ); //epprom_config_value++; working_mode ++; + blink_myled(working_mode); if (working_mode == 7) working_mode=0; - pc.printf("working_mode %d \r\n", working_mode); + //pc.printf("working_mode %d \r\n", working_mode); //pc.printf("Button pressed \r\n"); }; @@ -147,6 +157,9 @@ confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) + heater_OFF = 1; + pomp_OFF = 1; + eeprom_config_value = get_temp_config_value(); wd.Configure(10.0); @@ -165,21 +178,10 @@ pc.attach(&rxCallback, Serial::RxIrq); pc.baud(115200); pc.printf("\r\nNaumovich 2.0\r\n"); - - - pomp_OFF = 0; - heater_OFF = 0; - wait(0.25); - pomp_OFF = 1; - heater_OFF = 1; - wait(0.25); - pomp_OFF = 0; - heater_OFF = 0; - wait(0.25); - pomp_OFF = 1; - heater_OFF = 1; - wait(0.25); - + + blink_myled(3); + + queue.call( start_temp ); queue.call_every(100, at_command);