Code rewritten without Arduino.h

This commit is contained in:
KoroLion 2021-01-24 12:35:26 +03:00
parent 76c649475a
commit 8ca42b59b2

View File

@ -1,28 +1,28 @@
// Copyright 2021 KoroLion (https://github.com/KoroLion)
extern "C" {
void lm35_init(uint8_t port);
uint8_t lm35_read();
void lm35_init(unsigned char port);
unsigned char lm35_read();
void led_init();
void led_enable();
void led_disable();
}
void setup() {
Serial.begin(9600);
lm35_init(A3);
led_init();
}
const unsigned char LED_TEMP = 30;
void loop() {
uint8_t t = lm35_read();
if (t >= 30) {
led_enable();
} else {
led_disable();
int main() {
lm35_init(17);
led_init();
while (true) {
unsigned char t = lm35_read();
if (t >= LED_TEMP) {
led_enable();
} else {
led_disable();
}
}
Serial.println(t);
return 0;
}