An LM35 Precision Temperature Sensor is attached to an Arduino microcontroller. The sensor takes 8 readings per second and reports their average, in both Celsius and Farenheit, to the Arduino software’s serial monitor. Also attached to the Arduino are a series of lights that receive input from the serial monitor and light up depending on the temperature reported. Temperatures reported in the pre-determined normal range mean green lights, while slightly elevated temperatures (possibly caused by the weather or some exertion on the part of the wearer) make the Sensi-Safe® glow yellow. Temperatures more than two degrees above normal make the Sensi-Safe® go red. The Arduino countsthe number of readings that are more than two degrees above normal, and if they are consistently high for more than a pre-determined number of counts, the red lights will begin to flash.
int pin = 0; // analog pin int tempc = 0,tempf=0; // temperature variables int samples[8]; // variables to make a better precision int maxi = -100,mini = 100; // to start max/min temperature int i; int LED = 13; int LED2 = 12; int LED3 = 11; int count=0;
void setup() { Serial.begin(9600); // start serial communication pinMode(LED, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); }
if (tempc > 33) { digitalWrite(LED, HIGH); count=count+1; if (count >2) { for(int i=0;i<20; i++) { digitalWrite(LED, HIGH); // set the LED on delay(200); // wait for a second digitalWrite(LED, LOW); // set the LED off delay(200); } } }