Devices & Components
Arduino Uno Rev3
SG90 Micro-servo motor
Rotary potentiometer (generic)
Jumper wires (generic)
9V battery (generic)
Software & Tools
Arduino IDE
Project description
Code
CODE
c_cpp
Copy and paste the code in your editor
1#include <Servo.h> 2 3Servo servo1; 4Servo servo2; 5 6int pot1 = A0; 7int pot2 = A1; 8 9int valPot1; 10int valPot2; 11 12void setup() { 13 servo1.attach(9); 14 servo2.attach(6); 15} 16 17void loop() { 18 valPot1 = analogRead(pot1); 19 valPot1 = map(valPot1, 0, 1023, 0, 180); 20 servo1.write(valPot1); 21 delay(15); 22 23 valPot2 = analogRead(pot2); 24 valPot2 = map(valPot2, 0, 1023, 0, 180); 25 servo2.write(valPot2); 26 delay(15); 27}
Downloadable files
SCHEMATICS
Download this and connect by the image. Make sure you have fritzing
SCHEMATICS
SCHEMATICS
Download this and connect by the image. Make sure you have fritzing
SCHEMATICS
Comments
Only logged in users can leave comments