// Include the necessary libraries
#include <Arduino.h>

// Define the analog pin for the LM35 temperature sensor
const int lm35Pin = A0;

// Define the onboard LED pin
const int ledPin = 13;

// Define variables to store temperature readings and LED blink intervals
int temperature;
int blinkInterval;

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  
  // Set the LED pin as an output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Read the analog value from the LM35 temperature sensor
  int sensorValue = analogRead(lm35Pin);
  
  // Convert the analog value to temperature in Celsius
  temperature = sensorValue * 0.488; // LM35 output is 10mV per degree celsius
  
  // Print the temperature to the serial monitor
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");
  
  // Check if temperature is below 30°C
  if (temperature < 30) {
    blinkInterval = 250; // Blink LED every 250 milliseconds
  } 
  // Check if temperature is above 30°C
  else {
    blinkInterval = 500; // Blink LED every 500 milliseconds
  }

  // Call the function to blink the LED based on the calculated interval
  blinkLED(blinkInterval);
}

void blinkLED(unsigned long interval) {
  static unsigned long previousTime = 0;
  static bool ledState = LOW;
  static unsigned long counter = 0;

  // Increment counter based on elapsed time
  counter++;

  if (counter >= interval / 20) {
    counter = 0; // Reset counter

    // Toggle LED state
    if (ledState == LOW) {
      digitalWrite(ledPin, HIGH);
      ledState = HIGH;
    } else {
      digitalWrite(ledPin, LOW);
      ledState = LOW;
    }
  }
}
$abcdeabcde151015202530fghijfghij
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
ntc1:GND
ntc1:VCC
ntc1:OUT