Question

I want to use a stepping motor to control the number of steps it moves. I set the “step revolution” to 60 and I set the...

I want to use a stepping motor to control the number of steps it moves. I set the “step revolution” to 60 and I set the number of steps to 1. But it hasn’t stopped for a long time and has been walking.

I am using a Arduino IDE to make a writing machine (X-Y Plotter)

It would be better if you could give me the code and explain it.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <Stepper.h>
int steps_per_revolution = 32; // change this to fit the number of steps per revolution for your motor

Stepper my_stepper(steps_per_revolution, 8, 9, 10, 11); // initialize the stepper library on pins 8 through 11: 

void setup() {
   Serial.begin(9600);
   myStepper.setSpeed(5);
}

void loop() {
   Serial.println("clockwise");
   my_stepper.step(steps_per_revolution);
   delay(500);

   while(1){}

}

Explaination:

You are moving the motor in your "void loop" function. That's why it keeps on going. I have moved the stepper motor in my code one step and then I have put the program in an infinite loop so it prevents the calling of the loop function again. If you want to use the stepper only once in the beginning, you can write your stepper commands in "void setup" function. Or for your writer bot, you need to use the stepper, again and again, so you can put the stepper commands in a function and call them whenever you need that in the program and rest of the time you can perform your other tasks. The arguments of function can be the number of steps you need it to move. Direction can be decided by changing the sign of the passed arguments. Like the one below:

void stepper_move(steps)

{

my_stepper.step(steps);

delay(500);

}

Add a comment
Know the answer?
Add Answer to:
I want to use a stepping motor to control the number of steps it moves. I set the “step revolution” to 60 and I set the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Summary Write a program that demonstrates the skills you’ve learned throughout this quarter. This type of...

    Summary Write a program that demonstrates the skills you’ve learned throughout this quarter. This type of project offers only a few guidelines and requirements, allowing you to invest as much time, effort and imagination as you want.  Submit your java programs (*.java) and any other I/O (*.txt) via Canvas  You’ve worked quite hard to make it this far, so have a bit of fun with this project! Design Brief: Use Case Scenario You are hired to develop a...

  • C# - Inheritance exercise I could not firgure out why my code was not working. I...

    C# - Inheritance exercise I could not firgure out why my code was not working. I was hoping someone could do it so i can see where i went wrong. STEP 1: Start a new C# Console Application project and rename its main class Program to ZooPark. Along with the ZooPark class, you need to create an Animal class. The ZooPark class is where you will create the animal objects and print out the details to the console. Add the...

  • I have this case study to solve. i want to ask which type of case study...

    I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

  • Read the attached article. Do you feel one style of banking control is more stable than...

    Read the attached article. Do you feel one style of banking control is more stable than the other? Why? Does one banking method minimize market volatility and risk better or is it just packaged differently? Do you feel the US (Western) Banking system can better control the patterns of behavior going forward that have caused economic damage in the past? Should the Fed continue its stimulus policy, reduce it or abandon it entirely (Google some recent articles to research this)?  (Please...

  •    Available Feb 11 at 12am - Mar 8 at 11:59pm 26 days Not for IV...

       Available Feb 11 at 12am - Mar 8 at 11:59pm 26 days Not for IV Use: The Story of an Enteral Tubing Misconnection The Story of Robin and Addison Lowe (United States) LEARNING OBJECTIVES After completing this case study, you will be able to: 1. Explore the scientific feld of human factors and how errors like tubing misconnections can be prevented. 2. Discuss the complexity of having two patients to treat, a mother and her fetus. 3. Describe suitable...

  • 14. Select the number of participants in the Beck & Watson study Group of answer choices...

    14. Select the number of participants in the Beck & Watson study Group of answer choices 8 13 22 35 15. Beck & Watson determined their final sample size via Group of answer choices coding saturation triangulation ethnography 16.Through their study, Beck & Watson determined Group of answer choices after a traumatic birth, subsequent births have no troubling effects after a traumatic birth, subsequent births brought fear, terror, anxiety, and dread Subsequent Childbirth After a Previous Traumatic Birth Beck, Cheryl...

  • i really need help with the graphs Driving Can Be Dangerous to Your Health: An Interrupted...

    i really need help with the graphs Driving Can Be Dangerous to Your Health: An Interrupted Case Study in Physiology Phil Stephens Department of Biology Villanova University Part 1-The Grandparents Arrive Dave pulled the cell phone out of his pocket, cursing himself for not putting it on vibrate. The children, Jason and Laura, were both asleep, and he knew that the rest of the day would not be fun if they were awakened from their naps. "Hi, Dave. We're just...

  • 10. The Beck & Watson article is a Group of answer choices quantitative study qualitative study...

    10. The Beck & Watson article is a Group of answer choices quantitative study qualitative study 11. Beck & Watson examined participants' experiences and perceptions using what type of research design? Group of answer choices particpant obersvation phenomenology 12. Select the participants in the Beck & Watson study Group of answer choices Caucasian women with 2-4 children Caucasian pregnant women 13. In the Beck & Watson study, data was collected via a(n) Group of answer choices internet study focus group...

  • please Identify the key points and main thesis of the article 2. Describe the skills you...

    please Identify the key points and main thesis of the article 2. Describe the skills you will need to develop to manage the hospital of the future. use critical analysis doing these questions Suggestion for writing assignmemnt make believe the reader has never read the article -what are the key points you would want the reader to know in order to understand the hospital of the future. In addition, managers, executives do not have time to read--so again what key...

  • Read “Instituionalizing our Demise: America vs Multiculturalism” by Roger Kimball on pg 268 and “Reinventing America”...

    Read “Instituionalizing our Demise: America vs Multiculturalism” by Roger Kimball on pg 268 and “Reinventing America” Call for a new national indentity” by Elizabeth Martinez on pg 275. Create a double entry notebook for each reading selection It should be atleast five observation and responses. wric 268 PART 2 essay pro. exactly how and why their authors disagree. Instead of with parties in conflict as mediators do, you will nt of view designed to appeal to both sides, mediatn posing...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT