daryllqayyimdarplayzgt
Published © CC BY-ND

Controll servo with Joysticks

Boring with basic servo?This project let you controll the servo manually with joysticks.

BeginnerProtip592
Controll servo with Joysticks

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Analog joystick (Generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

See the schematics and just copy it

Code

Copy and paste the code at arduino IDE

Java
#include <Servo.h>
const int Y_pin = A0; // analog pin connected to Y output

Servo myservo;  

int val;    

void setup() {
  myservo.attach(9); 
}

void loop() {
  val = analogRead(Y_pin);            
  val = map(val, 0, 1023, 0, 180);     
  myservo.write(val);                  
  delay(15);                           
}

Credits

daryllqayyim
8 projects • 4 followers
Contact
darplayzgt
9 projects • 3 followers
Contact

Comments

Please log in or sign up to comment.