Skip to content

Instantly share code, notes, and snippets.

@margmarg
Last active October 12, 2020 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save margmarg/1803bbce695a37fb0a5f60a6169504f4 to your computer and use it in GitHub Desktop.
Save margmarg/1803bbce695a37fb0a5f60a6169504f4 to your computer and use it in GitHub Desktop.
#include <Servo.h>
Servo myservo;
void setup() {
// put your setup code here, to run once:
myservo.attach(9);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(A0);
// int outputValue = map(sensorValue, 0, 1023, 0, 180);
Serial.print(sensorValue);
Serial.print(",");
// Serial.println(outputValue);
myservo.write(sensorValue);
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment