-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode
More file actions
23 lines (18 loc) · 610 Bytes
/
Copy pathcode
File metadata and controls
23 lines (18 loc) · 610 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int sensorPin = A0; // Analog pin for sensor
int threshold = 500; // Threshold for detecting stress
int sensorValue = 0;
void setup() {
Serial.begin(9600); // Start serial communication
pinMode(13, OUTPUT); // Buzzer pin
}
void loop() {
sensorValue = analogRead(sensorPin); // Read sensor value
if (sensorValue > threshold) {
digitalWrite(13, HIGH); // Turn on buzzer if lie detected
Serial.println("Lie Detected!");
} else {
digitalWrite(13, LOW); // Turn off buzzer
Serial.println("No Lie Detected.");
}
delay(1000); // Wait for a second before reading again
}