#include "LedControl.h"

#define LM35 A0

//#define LED_PIN9

LedControl lc = LedControl{12,11,10,1}; // DIN, CLK,CK


void setup(){
lc.shutdown(0, false);
lc.setIntensity(0,7);
lc.clearDisplay(0);


//pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
pinMode(13, OUTPUT);


}

void loop () {
// read temperaturefrom LM35

int ar = anlogRead(LM35);
float mv = ar*(5000.0 / 1023.0);
float celsius = mv/10.0;

//Display temperature on the seven - segment display

displayTemperature(celsius);
// check temperature and turn on LED if its above a certain thresold

if (celsius> = 30.0) {
  digitalWrite(13, HIGH);
}
else{
  digitalWrite(13, LOW);
}
delay(3000); // Adjust delay as meeded


}


void displayTemperature ( float temperature){
  //display the temperature in the seven segment display

  int digit1 = int(temperature)/10;
  int digit2 = int(temperature) % 10;
  int decimal = (int((temperature) - int(temperature)) * 10);

  lc.setDigit(0,3, digit1, false);
  lc.setDigit(0,2, digit2, true);
  lc.setDigit(0,1, decimal, false);
  lc.setRow(0,0,B01001110);

}
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