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: "Stepper Motor Loop"
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-28 07:23:57
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Programme an arduino Uno to use two stepper motors */
- /* with driver, A4988 and CNC shield to achieve */
- /* motion, 360° with one second delay simultaneously */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <Stepper.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t Motordriver_A4988StepperMotorDriver_MS3_PIN_D5 = 5;
- const uint8_t Motordriver_A4988StepperMotorDriver_DIR_PIN_D9 = 9;
- /***** DEFINITION OF STEPPER MOTOR OBJECTS *****/
- Stepper motor1(200, Motordriver_A4988StepperMotorDriver_DIR_PIN_D9, Motordriver_A4988StepperMotorDriver_MS3_PIN_D5);
- Stepper motor2(200, Motordriver_A4988StepperMotorDriver_DIR_PIN_D9, Motordriver_A4988StepperMotorDriver_MS3_PIN_D5);
- void setup(void)
- {
- // Set the speed of the motors to 360 steps per minute
- motor1.setSpeed(360);
- motor2.setSpeed(360);
- }
- void loop(void)
- {
- // Move both motors 360° in one direction
- motor1.step(200);
- motor2.step(200);
- // Delay for 1 second
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement