Temperature Sensor + Potentiometer
const int POT = 0;
double val = 0;
double voltage = 0;
float temp = 0;
int red = 7;
int green = 6;
int blue = 5;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
val = analogRead(A0);
voltage = (val)*5;
temp = (voltage-500)/10;
Serial.println(val);
delay(500);
if (val<140){
digitalWrite(blue, HIGH);
}
else if (140<=val<= 150){
digitalWrite(green, HIGH);
}
if (150 < val){
digitalWrite(red, HIGH);
}
}
double val = 0;
double voltage = 0;
float temp = 0;
int red = 7;
int green = 6;
int blue = 5;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
val = analogRead(A0);
voltage = (val)*5;
temp = (voltage-500)/10;
Serial.println(val);
delay(500);
if (val<140){
digitalWrite(blue, HIGH);
}
else if (140<=val<= 150){
digitalWrite(green, HIGH);
}
if (150 < val){
digitalWrite(red, HIGH);
}
}
Comments
Post a Comment