ULN2003 Driver

High-power ULN2003 Stepper Motor Driver


14 ₪

الناشر: متجر القطع الالكترونية

القسم: متحكمات

تاريخ النشر: 2023-01-24




الربط مع الاردوينو

circuit diagram:



install lib:



install lib:



code

code
نسخ
اقتباس
عرض
تنزيل
	
								
/* * Created by ArduinoGetStarted.com * * This example code is in the public domain * * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-controls-28byj-48-stepper-motor-using-uln2003-driver */ // Include the AccelStepper Library #include <AccelStepper.h> // define step constant #define FULLSTEP 4 #define STEP_PER_REVOLUTION 2048 // this value is from datasheet // Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence AccelStepper stepper(FULLSTEP, 11, 9, 10, 8); void setup() { Serial.begin(9600); stepper.setMaxSpeed(1000.0); // set the maximum speed stepper.setAcceleration(50.0); // set acceleration stepper.setSpeed(200); // set initial speed stepper.setCurrentPosition(0); // set position stepper.moveTo(STEP_PER_REVOLUTION); // set target position: 64 steps <=> one revolution } void loop() { // change direction once the motor reaches target position if (stepper.distanceToGo() == 0) stepper.moveTo(-stepper.currentPosition()); stepper.run(); // MUST be called in loop() function Serial.print(F("Current Position: ")); Serial.println(stepper.currentPosition()); }


increase speed

code
نسخ
اقتباس
عرض
تنزيل
	
								
//Includes the Arduino Stepper Library #include <Stepper.h> // Defines the number of steps per rotation const int stepsPerRevolution = 2038; // Creates an instance of stepper class // Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);//OR//11, 9, 10, 8 void setup() { // Nothing to do (Stepper Library sets pins as outputs) } void loop() { //====================================slowly full rotation // Rotate CW slowly at 5 RPM myStepper.setSpeed(5); myStepper.step(stepsPerRevolution); delay(1000); // Rotate CCW slowly at 5 RPM myStepper.setSpeed(5); myStepper.step(-stepsPerRevolution); delay(1000); //==================================== //====================================slowly half rotation // Rotate CW slowly at 5 RPM myStepper.setSpeed(5); myStepper.step(stepsPerRevolution/2); delay(1000); // Rotate CCW slowly at 5 RPM myStepper.setSpeed(5); myStepper.step(-stepsPerRevolution/2); delay(1000); //==================================== //====================================quickly half rotation // Rotate CW quickly at 7 RPM myStepper.setSpeed(7); myStepper.step(stepsPerRevolution/2); delay(1000); // Rotate CCW quickly at 7 RPM myStepper.setSpeed(7); myStepper.step(-stepsPerRevolution/2); delay(1000); //==================================== }


سلة المشتريات افراغ السلة