-#include <Servo.h>
-
-const int ledPin = 12;
int cnt = 0;
-
-Servo servo;
-
-int OldHumanBody = 0;
-
+const int ledPin = 12;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
-
pinMode(0, INPUT);
pinMode(1, INPUT);
pinMode(2, INPUT);
-
- servo.attach(9);
}
void loop() {
int hb = analogRead(2); // Human Body
+ digitalWrite(ledPin, hb > 0 ? HIGH : LOW);
+
delay(100);
- float temperature;
- float resistance = (float)(1023-tv)*10000/tv;
- temperature = 1/(log(resistance/10000)/3975+1/298.15) - 273.15;
if(cnt % 10 == 0)
{
+ float temperature;
+ float resistance = (float)(1023-tv)*10000/tv;
+ temperature = 1.00000/(log(resistance/10000)/3975+1/298.15) - 273.15;
+
Serial.print("Light Sensor Value: ");
Serial.println(lv);
Serial.print(hb);
Serial.println(" ");
}
-
- if(lv < 400)
- {
- digitalWrite(ledPin, HIGH);
- }
- else
- {
- digitalWrite(ledPin, LOW);
- }
-
- int degree = map(hb, 0, 1023, 0, 179);
-
- /*
- Serial.print("fffffffffffffffffffffffffffffffffff: ");
- Serial.print(OldHumanBody);
- Serial.print(" ");
- Serial.print(hb);
- Serial.println(" ");*/
-
- if(OldHumanBody ==0 && hb == 0)
- {
-
- }
- else
- {
- servo.write(degree);
- }
-
- OldHumanBody = hb;
}