Introduction: Servo Gladiators

In this project we put two potentiometers in two breadboards to control servo motors. The servo motors will fight to the death!!!!!!

***This project is just a prototype. We are looking to make a bigger one with a bigger servo motor. We are still working on the code.

Step 1: Materials

Arduino

2 breadboards

2 potentiometers

2 servo motors

20 wires

Power supply ac/dc adapter

Step 2: Servo Motor

*** When you are doing this project keep this picture in mind.

https://www.google.com/search?q=servo+motor+arduino&rlz=1C5CHFA_enUS718US718&source=lnms&tbm=isch&sa=X&ved=0ahUKEwj1ks7C7LrYAhXpSN8KHX-HBGYQ_AUICigB&biw=1229&bih=981&dpr=1.25#imgrc=Tcc2IFNkUH95_M:

Step 3: Code

#include < Servo.h >

Servo myservo; // create servo object to control a servo Servo myservo1;

int potpin = 0; // analog pin used to connect the potentiometer

int val= 0;// variable to read the value from the analog pin

int potpin2=A2;

int val2=0;

void setup() {

myservo.attach(9); // attaches the servo on pin 9 to the servo object

myservo1.attach(10); pinMode(potpin,INPUT);

pinMode(potpin2,INPUT);

Serial.begin(9600); }

void loop(); {

val = analogRead(potpin);

val2 = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023)

val = map(val, 0, 1023, 0, 180);// scale it to use it with the servo (value between 0 and 180)

val2 = map(val2, 0, 1023, 0, 180);

Serial.println (val);

Serial.print (val2);

myservo.write(val);

myservo1.write(val2); // sets the servo position according to the scaled value

delay(10); // waits for the servo to get there }

Step 4: Steps:

1.) place the two petentiometers in seperate breadboards.

2.) Place the pins in back of it.

1st petentiometer:

left pin goes to minus

middle pin goes to A0

Right pin goes to plus.

2nd petentiometer:

left pin goes to plus on the other breadboard.

middle pin goes to a2 in the arduino.

right pin goes to minus in the other arduino.

1st Servo motor:

Brown goes to ground

Red goes to plus

Orange goes to pin in the arduino. we used d10.

2nd servo motor

Brown goes to ground

Red goes to plus

Orange goes to pin. We used d9

Step 5: Pictures:

Optional: You can add swords to the ends.

By: Justin Herskowitz and Ian Friedman

Arduino Contest 2017

Participated in the
Arduino Contest 2017