You are on page 1of 2

#include<Servo.

h>
#include <Wire.h> // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h>
// folosesc libraria pentru afisaje LCD simple
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I
2C address
int t1;
int sonerie
float t10;
float t11;
float t12;

= 10; //pinul 10
//
// temperatura
//

int temperaturePin1 = A0;


//senzorul de temperatura este legat la pinul A0
//servo
Servo myservo;
boolean test = false;
//bluetooth
char citireSerial; //valoarea trimis prin bluetooth
const int pinLed = 8;
//led
int const led = 13;
void setup() {
// temperaturaSetup();
bluetoothSetup();
pinMode(led, OUTPUT);
//servoSetup();

} // END void setup


//BLUETOOTH
void bluetoothSetup() {
Serial.begin(9600);
}
//SERVO
//void servoSetup() {
// myservo.attach(A3);//attachs the servo on pin 9 to servo object
// myservo.write(0);//back to 0 degrees
// delay(1000);//wait for a second
//}
//TEMPERATURA
void temperaturaSetup() {
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
pinMode(sonerie, OUTPUT);

//pinMode(led, OUTPUT);
lcd.clear(); // clear the screen
lcd.setCursor(0, 0); // put cursor at colon 2 and row 0 = left/up
lcd.print("Temperatura"); // print a text
lcd.setCursor(1, 1); // put cursor at colon 0 and row 0 = left/down
lcd.print("locala"); // print a text
delay (2000);
lcd.clear(); // clear the screen
}
void temperaturaLoop() {

// Read and store Sensor Data


t11 = 0;
for (int x = 1; x <= 5; x++) {
t1 = analogRead(temperaturePin1); // read value from temperature from first
sensor (LM335);
t10 = 100.0 * (5.0 * t1 / 1023.0 - 2.980) + 25.0 - 1.0;
t11 = t10 + t11;
delay (500);
}
t12 = t11 / 5.0 - 2.0 ; // average and corrected temperature
lcd.setCursor(3, 0);
if (t12 < 10) lcd.print(" ");
if (t12 > 0.0) lcd.print("+");
lcd.print(t12, 1);
Serial.println(t12);
while (t12 > 29) {
for (int i = 0 ; i < 30 ; i++) {
if (i == 29 ) break;
digitalWrite(sonerie, HIGH);
delay(25);
digitalWrite(sonerie, LOW);
delay(10);
}
break;
}
lcd.print("C");
delay(500);
}

You might also like