Tag Archives: ARDUINO UNO Project 05: Mood Cue

ARDUINO UNO Project 05: Mood Cue

Published by:

ARDUINO UNO Project 05: Mood Cue

Ingredients :

1- potentiometer       #1

2- capacitor 100µF    #2

3- Servo motor         #1

 

BUILD THE CIRCUIT

ARDUINO UNO Project 05: Mood Cue

 

 

Code:

#include <Servo.h>
Servo TestServo;
int const potPin=A0;
int potValue;
int angle;
void setup() {
TestServo.attach(9);
Serial.begin(9600);

}

void loop() {
potValue=analogRead(potPin);
Serial.print(“potValue: “);
Serial.print(potValue);
angle=map(potValue, 0,1023,0,179);
Serial.print(“,angle: “);
Serial.println(angle);
TestServo.write(angle);
delay(15);
}