Skip to content

Instantly share code, notes, and snippets.

@jarryDk jarryDk/Mood-Clue.h
Created Nov 17, 2015

Embed
What would you like to do?
#include <Servo.h>
Servo myServo;
int const potPin = A0;
int potVal;
int angle;
void setup() {
myServo.attach(9);
Serial.begin(9600);
}
void loop() {
potVal = analogRead(potPin);
Serial.print("potVal: ");
Serial.print(potVal);
angle = map(potVal, 0, 1023,0,179);
Serial.print(", angle: ");
Serial.print(angle);
myServo.write(angle);
delay(15);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.