User manual
003
int green, blue, red ;
004
005
if (val <= 10 & val >= -20)
006
blue = map(val, -20, 10, 255, 0);
007
else blue = 0;
008
009
if (val >= 10 & val <= 40)
010
green = map(val, 10, 40, 255, 0);
011
else if (val >= -20 & val < 10) green = map(val, -20, 10, 0, 255);
012
else green = 0;
013
014
if (val > 10 & val <= 40) red = map(val, 10, 40, 0, 255);
015
else red = 0;
016
017
analogWrite(RED, red);
018
analogWrite(GREEN, green);
019
analogWrite(BLUE, blue);
020
}
Adjustment of the LED brightnesses is done in the function rgbTemp(). The map-
command will convert the values into the matching byte values (0-255) and output
them at the LED. Blue means particularly cold temperature; it influences the range
of –20 °C to +10 °C. Green is involved in the entire temperature range, but is
strongest at value 10 °C. Red will only start at a value of +10 °C and has its maxi-
mum at +40 °C. This provides an intuitive colour code that suggests the current
temperature in addition to the more precise display on the serial monitor.
TCP SERVER