These are the pins where the servo is attached to, in this case the servos are attached to 5 and pin 9. pinMode(buttonPin, INPUT) sets up a pin for the button.On the next two lines you'll see servo.attach(5) and servoLock.attach(9). In this case it is set to 9600 bits per second. The Serial.begin(9600) is to set the communication speed. In this step we're going to write the code to control the servos. The circuit is done and we can start coding! Connect the red wire of the USB cable with the VIN pin on the Arduino and the other one with the ground (GND pin). Strip the USB cable to get a cable where one end is an USB input and the other end are two wires. Connect the yellow wire to pin 7 on the Arduino, connect the red wire to the positive side of the breadboard and the blue wire to the negative side of the breadboard.Ĭonnect the positive side of the breadboard to 5v and connect the negative side of the breadboard to the ground (GND pin). Solder two wires to the button as shown on the pictures. Solder the resistor to the button and solder a wire to the other end of the resistor. I used some jumper wires to connect the servos but any other wire will work too. Connect the red wires of both servos to positive side of the breadboard and connect the brown wires of both servos to the negative side of the breadboard. Connect the yellow wire of the second servo to pin 9. This will be the servo to shoot the catapult. Connect the yellow wire of the first servo to pin 5.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |