2021-01-22 02:24:05 +03:00
|
|
|
// Copyright 2021 KoroLion (https://github.com/KoroLion)
|
2021-01-19 12:28:33 +03:00
|
|
|
|
2021-01-22 02:24:05 +03:00
|
|
|
extern "C" {
|
2021-01-24 12:35:26 +03:00
|
|
|
void lm35_init(unsigned char port);
|
|
|
|
unsigned char lm35_read();
|
2021-01-19 12:28:33 +03:00
|
|
|
|
2021-01-22 02:24:05 +03:00
|
|
|
void led_init();
|
|
|
|
void led_enable();
|
|
|
|
void led_disable();
|
2021-01-19 12:28:33 +03:00
|
|
|
}
|
|
|
|
|
2021-01-24 12:35:26 +03:00
|
|
|
const unsigned char LED_TEMP = 30;
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
lm35_init(17);
|
2021-01-22 02:24:05 +03:00
|
|
|
led_init();
|
2021-01-19 12:28:33 +03:00
|
|
|
|
2021-01-24 12:35:26 +03:00
|
|
|
while (true) {
|
|
|
|
unsigned char t = lm35_read();
|
|
|
|
if (t >= LED_TEMP) {
|
|
|
|
led_enable();
|
|
|
|
} else {
|
|
|
|
led_disable();
|
|
|
|
}
|
2021-01-19 12:28:33 +03:00
|
|
|
}
|
|
|
|
|
2021-01-24 12:35:26 +03:00
|
|
|
return 0;
|
2021-01-19 12:28:33 +03:00
|
|
|
}
|