Nedelcu Teodora-Johanne
Prezentarea pe scurt a proiectului vostru: The lie detector uses a sensor that tells us the pulse of the person wearing it, therefore we are able to tell if they are lying or not.
We start the measuring of the pulse and if its elevated the person lied. A message will appear on the display with the result.
The code displays on LCD the amount of beats per minute calculated by the pulse sensor. I used the following libraries:
1. For the LCD display
LiquidCrystal_I2C.h Wire.h
2. For the pulse sensor
PulseSensorPlayground.h
Code:
#define USE_ARDUINO_INTERRUPTS true #include <PulseSensorPlayground.h> #include <LiquidCrystal_I2C.h> #include <Wire.h>
const int PulseWire = 0; int Threshold = 550;
LiquidCrystal_I2C lcd(0x27,16,2);
PulseSensorPlayground pulseSensor;
void setup() {
lcd.init(); Serial.begin(9600); pulseSensor.analogInput(PulseWire); pulseSensor.setThreshold(Threshold); if (pulseSensor.begin()) { Serial.println("We created a pulseSensor Object !"); }
}
void loop() {
int myBPM = pulseSensor.getBeatsPerMinute(); if (pulseSensor.sawStartOfBeat()) { Serial.println("♥ A HeartBeat Happened ! "); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("BPM"); lcd.setCursor(0, 1); if (myBPM < 100){ lcd.print(" "); lcd.print(myBPM); lcd.setCursor(4,1); lcd.print(" "); }else{ lcd.print(myBPM); lcd.setCursor(4,1); lcd.print("Lie"); } Serial.println(myBPM); } delay(20);
}
This project taught me how to use Arduino, LCD display and a pulse sensor. I think it would be fun to try and build different useful things this way.