Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: **Servo Control**
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-11-09 16:29:38
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* 3 servos will go up but 2 slower */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Servo.h> // Include the Servo library
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- // Create Servo objects
- Servo servo1; // Fast servo
- Servo servo2; // Slow servo 1
- Servo servo3; // Slow servo 2
- void setup(void)
- {
- // Attach servos to pins
- servo1.attach(9); // Attach fast servo to pin 9
- servo2.attach(10); // Attach slow servo 1 to pin 10
- servo3.attach(11); // Attach slow servo 2 to pin 11
- }
- void loop(void)
- {
- // Move the fast servo to 90 degrees
- servo1.write(90);
- delay(1000); // Wait for 1 second
- // Move the slow servos to 90 degrees
- servo2.write(90);
- servo3.write(90);
- delay(2000); // Wait for 2 seconds to move slower
- // Move the servos back to 0 degrees
- servo1.write(0);
- delay(1000); // Wait for 1 second
- // Move the slow servos back to 0 degrees
- servo2.write(0);
- servo3.write(0);
- delay(2000); // Wait for 2 seconds to move slower
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement