Thermo Cup
Language | English |
---|
目录ObjectiveThis cup can "sense" water temperature and present light based on program setting with different color. PrincipleTemperature and humidity sensor detects environment temperature and humidity and make light present different color in different sections. Equipment
Load the Code
Code Debugging
void readByAM2321()
{
AM2321 am2321;
am2321.read();
sensor_tem = am2321.temperature / 10.0;
Serial.println(sensor_tem);
delay(100);
}
#define temp1 28
#define temp2 30
#define temp3 32
if (sensor_tem <= temp1)
colorSet(strip.Color(0, 255, 0));
else if (sensor_tem > temp1 && sensor_tem <= temp2)
colorSet(strip.Color(0, 0, 255));
else if (sensor_tem > temp2 && sensor_tem <= temp3)
colorSet(strip.Color(255, 255, 0));
else
colorSet(strip.Color(255, 0, 0));
RGB value is method of defining light color. R(Red), G(Green) and B(Blue) are the three primary colors, whose values is 0-225. The value represents color intensity. Three different kinds of light can be superimposed together to form a variety of colors, such as (0, 225), that is green. Hardware Buildup
ResultThe sensor detects different temperature data. You can also build a beautiful shell with LEGO. Video |