Generation

generate functionTue, 09 May 2023

i have a 2 stepper motor and one servo motor and i want to make a cnc plotter

++ #include <Servo.h> #include <Stepper.h> const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution // for your motor // initialize the stepper library on pins 8 through 11: Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created int pos = 0; // variable to store the servo position void setup() { // put your setup code here, to run once: myservo.attach(7); // attaches the servo on pin 7 to the servo object myservo.write(90); //set the servo to 90 degrees Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: Serial.println("clockwise"); myStepper.step(stepsPerRevolution); delay(500); Serial.println

Questions about programming?Chat with your personal AI assistant