I am using a 24V 5A switching power supply.
Arduino UNO with potentiometer
and the code is:
Motor Driver HY-DIV268N-5A 5A 12-42V
<MODERATOR: Please use CODE tags when posing code. you can find the option in the ••• menu on the top of the edit box. I‘ve done it for you this time. Thanks!>
Arduino UNO with potentiometer
and the code is:
Arduino Stepper Motor Code:
const byte DIR = 2;
const byte PUL = 3;
int pulsos_por_revolucion = 1000;
int PPR = pulsos_por_revolucion;
float senal = A0;
void girar_derecha();
void girar_izquierda();
void setup() {
pinMode(DIR, OUTPUT);
pinMode(PUL, OUTPUT);
Serial.begin(9600);}
void loop() {
float sensorReading = analogRead(senal);
float motorSpeed = map(sensorReading, 0.0, 1023.0, 500, 30000);
Serial.println(motorSpeed);
if (motorSpeed < 25000){
digitalWrite(DIR, LOW);
for (int i = 0; i < 2; i++){
digitalWrite(PUL, HIGH);
delayMicroseconds(motorSpeed);
digitalWrite(PUL, LOW);
delayMicroseconds(motorSpeed);}}}
<MODERATOR: Please use CODE tags when posing code. you can find the option in the ••• menu on the top of the edit box. I‘ve done it for you this time. Thanks!>
Last edited by a moderator: