msr048
Published © GPL3+

Robotic Arm

A robotic arm using servo motors.

AdvancedFull instructions provided12,457
Robotic Arm

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Analog joystick (Generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
RobotGeek Continuous Rotation Servo
RobotGeek Continuous Rotation Servo
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

cardboard
Hot glue gun
Popsicle stick

Story

Read more

Schematics

Circuit Diagram

Code

Arduino code

Arduino
//www.youtube.com/Electronics is Fun//
//www.facebook.com/Electronics is Fun//
//copyright by MOHD SOHAIL//


#include <Servo.h>

//Servo objects created to control the servos
Servo myServo1;
Servo myServo2;

int servo1 = 3; //Digital PWM pin used by the servo 1
int servo2 = 5; //Digital PWM pin used by the servo 2
int joyX = 0;   //Analog pin to which the joystick (X) is connected
int joyY = 1;   //Analog pin to which the joystick (Y) is connected

void setup(){
  myServo1.attach(servo1);
  myServo2.attach(servo2);
}

void loop(){
  
  int valX = analogRead(joyX); //Read the joystick X value (value between 0 and 1023)
  int valY = analogRead(joyY); //Read the joystick Y value (value between 0 and 1023)

  valX = map(valX, 0, 1023, 10, 170); //Scale the joystick X value to use it with the servo
  valY = map(valY, 0, 1023, 10, 170); //Scale the joystick X value to use it with the servo

  //Sets the servo position according to the scaled values.
  myServo1.write(valX);   
  myServo2.write(valY);

  delay(5);
}

Credits

msr048

msr048

0 projects • 49 followers

Comments