files.catbox.moe/xtqdmv.mp4
1. Arduino Uno
2. HiLetgo Pulse Sensor Module
3. 5V Relay
4. Heart (4$/eBay)
5. Blair Witch Project
6. 10K Pot
7. 1K Resistor
8. NPN Transistor

- // Flashing Light Prize (4) Arduino Horror
- // vgmlr
- int led = 13;
- int relay = 2;
- int pulse = A0;
- int val;
- int tot;
- int nxt;
- int high;
- int potpin = A5;
- int potval;
- void setup() {
- Serial.begin(115200);
- pinMode(relay, OUTPUT);
- pinMode(led, OUTPUT);
- // Get Comfortable
- for (int i = 0; i <= 5; i++) {
- digitalWrite(led, HIGH);
- delay(500);
- digitalWrite(led, LOW);
- delay(500);
- }
- }
- void loop() {
- // Reset Value
- tot = 0;
- // Smoothing
- for (int i = 0; i <= 25; i++) {
- val = analogRead(pulse);
- tot = val + tot;
- delay(2);
- }
- nxt = tot / 25;
- Serial.println(nxt);
- // To Solve Pulse Reading Inconsistency
- // Adjust the Relay Trigger Peak Value
- potval = analogRead(potpin);
- high = map(potval, 0, 1023, 520, 570);
- if (nxt > high) {
- digitalWrite(relay, HIGH);
- digitalWrite(led, HIGH);
- } else {
- digitalWrite(relay, LOW);
- digitalWrite(led, LOW);
- }
- delay(5);
- }