Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fix the code: #include const int stepsPerRevolution = 200; Stepper myStepper(stepsPerRevolution, 3, 4, 5, 6); void setup() { Serial.begin(9600); myStepper.setSpeed(90); } void loop () {

Fix the code:

#include const int stepsPerRevolution = 200; Stepper myStepper(stepsPerRevolution, 3, 4, 5, 6);

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

void loop () { if (Serial.available()>0) { char commandChar = Serial.read(); int steps = Serial.parseInt(); switch (commandChar){

case 'a': //CCC Serial.print(" Enter turns:"); int steps = Serial.parseInt(); myStepper.step(stepsPerRevolution*steps); break; case 'b': //CCW Serial.print("Enter turns:"); int steps = Serial.parseInt(); myStepper.step(-steps); break; case 'c': //CSC myStepper.step(stepsPerRevolution); break;

case 'd': //CSW myStepper.step(-stepsPerRevolution); break;

case 'f': //STOP myStepper.setSpeed(0); break;

default: Serial.println("Invalid Command"); }}}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago