Hello All,
Thanks you for looking at this topic.
I am trying to control a stepper motor with a program from my computer. it is a 28BYJ-48 5V Stepper Motor ULN2003 Driver connected to a 5v external power supply and a Nano.
Code is as Followed:
#include <Stepper.h>
const int stepsPerRevolution = 2038; // 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, 9, 10, 11);
// Motor pin definitions:
// 8 IN1 on the ULN2003 driver
// 9 IN2 on the ULN2003 driver
// 10 IN3 on the ULN2003 driver
// 11 IN4 on the ULN2003 driver
int stepCount = 0; // number of steps the motor has taken
int movesteps = 0; // number of steps to move
void setup() {
// initialize the serial port:
Serial.begin(9600);
Serial.println("Serial Connected");
delay(1000);
Serial.println("Waiting for Inputs, Type in the number of steps 1 to 2038");
}
void loop() {
movesteps = Serial.read();
Serial.print("You typed: " );
Serial.println(movesteps);
myStepper.step(movesteps);
Serial.print("steps:");
Serial.println(stepCount);
stepCount++;
delay(200);
}
When i click a button on the software it will send a number, Example -250, and it should turn the motor 250 steps backwards via serial.
Am i right in thinking i need a USB232 TTL converter and connect this to pin 0 & 1 on the nano along with 5v and ground? or will the Nano connected to the computer with the onboard USB work?
or is everything ive listed total rubbish and i need to start again?