Robot Arm controlled with Potentiometers | 4 DOF - 4 Axis | Multiple Servo


In this video we will install the 4 axis robot arm set and we will control 4 axis robot arm with 4 potentiometers. In future videos, we will make the following projects with this robot arm: programmable robot arm, robot arm controlled by Bluetooth, robot arm controlled by nRF24L01 and joystick. Also in this video you can find the source code for the multiple servo control with potentiometer. This robotic arm set is ideal for beginners. That's why I recommend you get this robot arm set. Robot Arm Set Link -- https://goo.gl/SjS5E8 Package included: 1x 4DOF Robot Arm Kit 4x Mg90s Servo 1x Arduino Uno R3 Board 1x Potentiometer Control Board 4x Potentiometer with Caps 1x 5V 2A Power Adapter --------------------------------------------------------- Required Hardwares: DANIU 110V/220V 60W Adjust. Solder - https://goo.gl/2oZhtu DANIU Multifunctional Soldering Stand - https://goo.gl/2n8gds DANIU Solder Wire - https://goo.gl/FC7W6o DANIU Multi-purpose Screwdriver Wallet - https://goo.gl/i75Au5 --------------------------------------------------------- Source Code: Code is already installed on the Arduino from factory, so you can use directly. However, I created a source code for you. So you can make changes.
//add servo library
#include <Servo.h>

//define our servos
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

//define our potentiometers
int pot1 = A0;
int pot2 = A1;
int pot3 = A2;
int pot4 = A3;

//variable to read the values from the analog pin (potentiometers)
int valPot1;
int valPot2;
int valPot3;
int valPot4;

void setup()
{
  //attaches our servos on pins PWM 11-10-9-6 to the servos
  servo1.attach(11);
  servo2.attach(10);
  servo3.attach(9);
  servo4.attach(6);
}

void loop()
{
  //reads the value of potentiometers (value between 0 and 1023)

  valPot1 = analogRead(pot1);
  valPot1 = map (valPot1, 0, 1023, 0, 180);   //scale it to use it with the servo (value between 0 and 180)
  servo1.write(valPot1);                      //set the servo position according to the scaled value
  delay(5);
  
  valPot2 = analogRead(pot2);
  valPot2 = map (valPot2, 0, 1023, 0, 180);
  servo2.write(valPot2);
  delay(5);

  valPot3 = analogRead(pot3);
  valPot3 = map (valPot3, 0, 1023, 0, 180);
  servo3.write(valPot3);
  delay(5);

  valPot4 = analogRead(pot4);
  valPot4 = map (valPot4, 0, 1023, 0, 180);
  servo4.write(valPot4);
  delay(5);
}