Light of the Lotus was my idea for project 3. The idea was to have a temperature sensor inside of a glass lotus and when water of a certain temperature was poured into that lotus an LED would Light up from underneath. Initially, I wanted to have the sensor in the lotus, but then I realized this would create a short circuit. So I just manually carefully put the sensor in.
— Dhabia (@Dhvbia) February 18, 2019
float tempPin = A0;
float maxTemp = 50
;
int led = 2;
float temp, cel;
void setup() {
Serial.begin(9600);
pinMode(tempPin, INPUT); //the input recieved is the water's temp
pinMode(led, OUTPUT); //the output is the LED, so wether it is low high
}
void loop() {
int c = analogRead(tempPin);
float voltage = c * 5.0;
voltage /= 1024.0;
c = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
if(c > maxTemp) { // if temp is higher than tempMax
digitalWrite(led, HIGH); // turn on led
}
else { // else turn of led
digitalWrite(led, LOW); // turn on led
}
Serial.print("TEMP: ");
Serial.print(c); // display the temperature
Serial.print("C");
Serial.println();
}
float readTemp() { // get the temperature and convert it to celsius
temp = analogRead(tempPin);
return temp * 0.48828125;
}
#refrenced, will add urls later tonight
