Bird
0
0
Arduinoprogramming~20 mins

Stepper motor with driver module in Arduino - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Stepper Motor Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Stepper Motor Basic Rotation Output
What will be the output behavior of the stepper motor when running this Arduino code snippet?
Arduino
const int stepPin = 3;
const int dirPin = 4;

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  digitalWrite(dirPin, HIGH); // Set direction
}

void loop() {
  digitalWrite(stepPin, HIGH);
  delayMicroseconds(1000);
  digitalWrite(stepPin, LOW);
  delayMicroseconds(1000);
}
AThe motor rotates back and forth repeatedly.
BThe motor rotates continuously in one direction at a steady speed.
CThe motor does not rotate because the step pin is never pulsed.
DThe motor rotates continuously but changes direction every second.
Attempts:
2 left
💡 Hint
Look at how the step pin is pulsed and the direction pin is set once in setup.
🧠 Conceptual
intermediate
1:00remaining
Understanding Stepper Motor Driver Pins
Which pin on a typical stepper motor driver module controls the rotation direction of the motor?
AGround pin
BEnable pin
CStep pin
DDirection pin
Attempts:
2 left
💡 Hint
Think about which pin tells the motor which way to turn.
🔧 Debug
advanced
2:00remaining
Identify the Error in Stepper Motor Speed Control Code
What error will occur when running this Arduino code to control stepper motor speed?
Arduino
const int stepPin = 3;
const int dirPin = 4;

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  digitalWrite(dirPin, LOW);
}

void loop() {
  for (int i = 0; i < 200; i++) {
    digitalWrite(stepPin, HIGH);
    delay(1);
    digitalWrite(stepPin, LOW);
    delay(1);
  }
  delay(1000);
  delay(0);
}
AThe code runs without error and rotates the motor 200 steps then pauses.
BThe delay(0) causes a compile-time error because 0 is invalid.
CThe motor will not rotate because the direction pin is never set HIGH.
DThe motor rotates but the speed is too fast to control.
Attempts:
2 left
💡 Hint
Check if delay(0) is valid and what setting direction LOW means.
📝 Syntax
advanced
1:30remaining
Find the Syntax Error in Stepper Motor Control Code
Which option contains the correct syntax to set the step pin HIGH and LOW with a 500 microsecond delay between?
A
digitalWrite(stepPin, HIGH);
delayMicroseconds(500);
digitalWrite(stepPin, LOW);
delayMicroseconds(500);
B
;)005(sdnocesorciMyaled
;)WOL ,niPpets(etirWlatigid
;)005(sdnocesorciMyaled
;)HGIH ,niPpets(etirWlatigid
C
digitalWrite(stepPin, HIGH)
delayMicroseconds(500)
digitalWrite(stepPin, LOW)
delayMicroseconds(500)
D
digitalWrite(stepPin HIGH);
delayMicroseconds(500);
digitalWrite(stepPin LOW);
delayMicroseconds(500);
Attempts:
2 left
💡 Hint
Check for missing commas, semicolons, and parentheses.
🚀 Application
expert
2:00remaining
Calculate Steps for 90 Degree Rotation
A stepper motor has 200 steps per full revolution. Using a driver module, how many step pulses must be sent to rotate the motor shaft exactly 90 degrees?
A25 steps
B100 steps
C50 steps
D200 steps
Attempts:
2 left
💡 Hint
A full revolution is 360 degrees. Calculate the fraction for 90 degrees.