laurenkoi
Published

Arduino Project 5: Mood Cue

Turning a servo motors and using build-in libraries. *add cardboard*

BeginnerShowcase (no instructions)1 hour82
Arduino Project 5: Mood Cue

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Rotary Potentiometer, 10 kohm
Rotary Potentiometer, 10 kohm
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Capacitor 100 µF
Capacitor 100 µF
×1

Story

Read more

Schematics

Video

Mood Cue Functioning

Fritzing

Schematics

Code

Mood Cue Code

Arduino
//Import a library from the Arduino folder
#include <CapacitiveSensor.h>
//Select the two pins that will act as a capacitor
CapacitiveSensor capSensor = CapacitiveSensor(4,2);
//Insert the minimum value provided by the sensor to detect the touch
int threshold = 1000;
const int ledPin = 12;

void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

void loop() {
//Read the sensor value
long sensorValue = capSensor.capacitiveSensor(30);
Serial.println(sensorValue);
//Touch detected
if (sensorValue > threshold) {
//Turn on the led
digitalWrite(ledPin, HIGH);
}
//Touch undetected
else {
//Turn off the led
digitalWrite(ledPin, LOW);
}
delay(10);
}

Credits

laurenkoi

laurenkoi

13 projects • 1 follower

Comments