MadIIT
Published

Boom of an Excavator

With the help of Servos and Joystick you can to make this easily. The joystick controls the movement of the Servo proportionally

IntermediateFull instructions provided1 hour199
Boom of an Excavator

Things used in this project

Hardware components

SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Joystick, 10 kohm
Joystick, 10 kohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Boom of an Excavator

C/C++
#include <Servo.h>
Servo Boom1;
Servo Boom2;
Servo Buck;

int x1 = A4;
int y1 = A5;
int s1 = A3;

int y2 = A0;
int s2 = A1;
int x2 = 13;

float posBoom1 = 0;
float posBoom2 = 0;
float posBuck = 0;

void setup() {
  Boom1.attach(10);
  Boom2.attach(6);
  Buck.attach(3);

  Serial.begin(9600);

  pinMode(x1,INPUT);
  pinMode(y1,INPUT);
  pinMode(s1,INPUT);
  pinMode(x2,INPUT);
  pinMode(s2,INPUT);
  pinMode(y2,INPUT);

}

void loop() {
  Buck.write(analogRead(x1)/1023.0 * 180.0);
  Boom2.write(analogRead(y1)/1023.0 * 90.0);
  Boom1.write(analogRead(y2)/1023.0 * 80.0);

}

Credits

MadIIT
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.