Challenge - 5 Problems
Stepper Motor Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Stepper Motor Step Sequence Output
What will be the output on the serial monitor when this Arduino code runs?
Arduino
int step = 0; void setup() { Serial.begin(9600); } void loop() { Serial.print("Step: "); Serial.println(step); step = (step + 1) % 4; delay(500); }
Attempts:
2 left
💡 Hint
Look at how the step variable changes and resets using modulo.
✗ Incorrect
The step variable increases by 1 each loop and resets to 0 after reaching 3 because of the modulo 4 operation. So the output cycles through 0,1,2,3 repeatedly.
🧠 Conceptual
intermediate1:30remaining
Understanding Stepper Motor Coil Activation
In a 4-step sequence for a unipolar stepper motor, which coil activation pattern correctly represents the sequence?
Attempts:
2 left
💡 Hint
Think about the order coils are energized to rotate the motor smoothly.
✗ Incorrect
The correct sequence energizes coils in order A+, B+, A-, B- to create a smooth rotation.
🔧 Debug
advanced2:30remaining
Identify the Error in Stepper Motor Wiring Code
What error will this Arduino code cause when controlling a stepper motor?
Arduino
int motorPin1 = 8; int motorPin2 = 9; int motorPin3 = 10; int motorPin4 = 11; void setup() { pinMode(motorPin1, OUTPUT); pinMode(motorPin2, OUTPUT); pinMode(motorPin3, OUTPUT); pinMode(motorPin4, OUTPUT); } void loop() { digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, HIGH); delay(1000); }
Attempts:
2 left
💡 Hint
Consider what happens if all coils are powered simultaneously.
✗ Incorrect
Energizing all coils at once prevents the motor from stepping and can cause overheating or damage.
📝 Syntax
advanced1:30remaining
Find the Syntax Error in Stepper Motor Control Code
Which option contains the correct syntax to set pin 8 HIGH and pin 9 LOW in Arduino?
Attempts:
2 left
💡 Hint
Check for missing commas, semicolons, and parentheses.
✗ Incorrect
Option A has correct syntax with commas separating arguments and semicolons ending statements.
🚀 Application
expert2:00remaining
Calculate Steps for Desired Rotation Angle
A stepper motor has 200 steps per full revolution (360 degrees). How many steps are needed to rotate the motor shaft by 90 degrees?
Attempts:
2 left
💡 Hint
Calculate steps by proportion: (desired angle / 360) * total steps.
✗ Incorrect
90 degrees is one quarter of 360 degrees, so steps = 200 * (90/360) = 50 steps.
