From 8ca42b59b27f38ff7e98391a6633ebb8100d4606 Mon Sep 17 00:00:00 2001 From: KoroLion Date: Sun, 24 Jan 2021 12:35:26 +0300 Subject: [PATCH] Code rewritten without Arduino.h --- src/avr_asm_lib/avr_asm_lib.ino | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/avr_asm_lib/avr_asm_lib.ino b/src/avr_asm_lib/avr_asm_lib.ino index 9382372..436545f 100644 --- a/src/avr_asm_lib/avr_asm_lib.ino +++ b/src/avr_asm_lib/avr_asm_lib.ino @@ -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; }