Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Dante Roumega
Published © GPL3+

Arduino Lie Detector

Someone has been eating my cookies! Thankfully Arduino is here to help find out who it is.

BeginnerFull instructions provided3 hours179,756
Arduino Lie Detector

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
LED (generic)
LED (generic)
×1
Resistor 2K
×1
Cables
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)
Soldering Wire

Story

Read more

Schematics

Wiring diagram

Code

PolyGraph.ino

Arduino
Paste the code into the arduino ide
void setup()
{
	Serial.begin(9600);
	pinMode(2, OUTPUT);
	pinMode(3, OUTPUT);
	pinMode(4, OUTPUT);
	digitalWrite(2, HIGH);
	delay(500);
	digitalWrite(3, HIGH);
	delay(500);
	digitalWrite(4, HIGH);
	delay(500);
}

void loop()
{
	if (analogRead(A0) > 60)
	{
		digitalWrite(4, HIGH);
	}
	else
	{
		digitalWrite(4, LOW);
	}
	if (analogRead(A0) > 20)
	{
		digitalWrite(2, HIGH);
	}
	else
	{
		digitalWrite(2, LOW);
	}
	if (analogRead(A0) > 45)
	{
		digitalWrite(3, HIGH);
	}
	else
	{
		digitalWrite(3, LOW);
	}

	Serial.println(analogRead(A0));
	delay(20);
}

Credits

Dante Roumega
14 projects • 179 followers
Im 19 and I love electrical engineering

Comments