Skip to content

Instantly share code, notes, and snippets.

@giljr
Created December 2, 2018 01:47
Show Gist options
  • Select an option

  • Save giljr/5b157244637212f85d71395573c83c62 to your computer and use it in GitHub Desktop.

Select an option

Save giljr/5b157244637212f85d71395573c83c62 to your computer and use it in GitHub Desktop.
Arduino UNO — Quick Intro A Workshop in BSB with the Kids :) https://medium.com/kidstronics/arduino-uno-quick-intro-94c7c682740a
/*
Kids-Serie#10
Project : Arduino Start Up
Ino File: _10_ControllingServo_04.ino
*/
#include <Servo.h>
Servo myServo;
void setup() { // put your setup code here, to run once:
myServo.attach(9);
}
void loop() { // put your main code here, to run repeatedly:
int potValue = analogRead(0); // readings from the potentiometer and transform
potValue = map(potValue, 0, 1023, 0, 180);
myServo.write(potValue); // the number so the servo turns 180º
delay(15);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment