TransWikia.com

loop once per startup for stepper motor

Arduino Asked by bo na fi de on February 15, 2021

First of all sorry that i dont know much about programming, most of my codes are just copy paste. And of course, i know this question has been asked before, but while using this code:

#include <AccelStepper.h>

AccelStepper stepper (1,7,6);

void setup() {
  // put your setup code here, to run once:
 
 stepper.setMaxSpeed(100);
 
 stepper.setAcceleration(20);
 
  stepper.runToNewPosition(100);
 
 delay (1000);
 
stepper.runToNewPosition(0);
 
delay(1000);

}

void loop() {
  // put your main code here, to run repeatedly:

}

The code worked perfectly once but after resetting the power the code doesnt work in a way that my stepper motor just idles. Obviously what I want is for the stepper motor to execute the code once per power on. Is there something that i miss? many thanks!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP