Arduino Uno - Nano Step motor code

Hi,
I used this code at Arduino Uno without problem:

#include <AccelStepper.h>
#include <Wire.h>
#define HALFSTEP 8

#define motorPin1  2     // IN1 on the ULN2003 driver 1
#define motorPin2  3     // IN2 on the ULN2003 driver 1
#define motorPin3  4     // IN3 on the ULN2003 driver 1
#define motorPin4  5     // IN4 on the ULN2003 driver 1

AccelStepper stepper(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);

void setup()
{  
   stepper.setMaxSpeed(1000);
   stepper.setSpeed(127.7);	
}

void loop()
{  
   stepper.runSpeed();
}

Isn’t it possible using the same code at Arduino nano? Or should i change something for nano?

PS: I tried it, but it didn’t work.

I think that program should work just the same on a Nano.

How are you powering the stepper motor? It should not be powered from the Arduino (either Uno or Nano).

…R

How did it not work? I use Uno and Nano interchangeably with the same code with no problem. I use my own software so I can only suggest it's a problem with AccelStepper, but that doesn't make sense either.

Robin2: I think that program should work just the same on a Nano.

How are you powering the stepper motor? It should not be powered from the Arduino (either Uno or Nano).

...R

With ULN2003A Step Motor Driver Card.

drkoray: With ULN2003A Step Motor Driver Card.

A motor driver card does not generate electricity. Where is the electricity coming from?

...R

Robin2: A motor driver card does not generate electricity. Where is the electricity coming from?

...R

From Arduino 5V and GND.

drkoray: From Arduino 5V and GND.

Did you read all of Reply #1 ?

...R

Robin2: Did you read all of Reply #1 ?

...R

Of course. Problem is: The code and step motor work at uno with the same connection schema. When i change uno with nano, motor doesn't work.

Sometimes electronic stuff can work outside of the specification. That doesn't mean it's guaranteed to always work that way! I suspect your Uno can power the stepper motor by operating (temporarily) above it's specified current limit. Your nano on the other hand, has a tighter tolerance, and the motor cannot over-amp it the way it does to the Uno.

Uno and Nano have different voltage regulators. Uno: NCP1117 series - over 1.0 A Nano: µA78M05 - up to 500 mA