1#include <SoftwareSerial.h>
2#include <OneWire.h>
3#include <DallasTemperature.h>
4
5#define ONE_WIRE_BUS 2
6SoftwareSerial BzSerial(3,4);
7const int LED = 13;
8OneWire oneWire(ONE_WIRE_BUS);
9
10DallasTemperature sensors(&oneWire);
11
12 float Celcius=0;
13 float Fahrenheit=0;
14void setup(void)
15{
16 BzSerial.begin(9600);
17 Serial.begin(9600);
18 sensors.begin();
19}
20
21void loop(void)
22{
23 sensors.requestTemperatures();
24 Celcius=sensors.getTempCByIndex(0);
25 Fahrenheit=sensors.toFahrenheit(Celcius);
26 BzSerial.print(Celcius);
27 BzSerial.print(" *C ");
28 BzSerial.println(Fahrenheit);
29 BzSerial.print(" F");
30 int C = Celcius;
31 if(C>30)
32 {
33 BzSerial.println("Temperature Exceeds above 30*C ");
34 }
35 else
36 {
37 BzSerial.println("Temperature is below 30*C ");
38 }
39 delay(1000);
40}
41
1abdulhamidmohammed
7 months ago
Can the temperature be controlled through a mobile app?