온도 센서 활용
Last updated
Last updated
#include <SoftwareSerial.h>
const int LM35PIN = A0;
SoftwareSerial BTSerial(2, 3);//TX, RX
void setup(){
Serial.begin(9600);
BTSerial.begin(9600);
Serial.println("Start temparture system");
}
void loop(){
if(BTSerial.available()){
String input = BTSerial.readString();
if(input.equals("temp")){
int input = analogRead(LM35PIN);
float temperature = (5.0 * input * 100) / 1024;
BTSerial.print("Temperature(Celsius) : ");
BTSerial.println(temperature);
}
}
}