Bird
0
0
Arduinoprogramming~20 mins

Stepper motor basics in Arduino - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Stepper Motor Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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);
}
AStep: 0\nStep: 1\nStep: 2\nStep: 3\nStep: 0\n...
BStep: 1\nStep: 2\nStep: 3\nStep: 4\nStep: 1\n...
CStep: 0\nStep: 2\nStep: 4\nStep: 6\nStep: 0\n...
DStep: 1\nStep: 3\nStep: 5\nStep: 7\nStep: 1\n...
Attempts:
2 left
💡 Hint
Look at how the step variable changes and resets using modulo.
🧠 Conceptual
intermediate
1:30remaining
Understanding Stepper Motor Coil Activation
In a 4-step sequence for a unipolar stepper motor, which coil activation pattern correctly represents the sequence?
AB+, A+, B-, A-
BA+, B+, A-, B-
CA+, B-, A-, B+
DA+, A-, B+, B-
Attempts:
2 left
💡 Hint
Think about the order coils are energized to rotate the motor smoothly.
🔧 Debug
advanced
2: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);
}
AThe motor will rotate backwards continuously.
BThe code will not compile due to missing semicolons.
CThe motor coils are all energized at once, causing no rotation and possible overheating.
DThe Arduino will reset due to pin conflict.
Attempts:
2 left
💡 Hint
Consider what happens if all coils are powered simultaneously.
📝 Syntax
advanced
1: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?
A
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
B
digitalWrite(8 HIGH);
digitalWrite(9 LOW);
C
digitalWrite(8, HIGH)
digitalWrite(9, LOW);
D
digitalWrite(8, HIGH);
digitalWrite(9, LOW)
Attempts:
2 left
💡 Hint
Check for missing commas, semicolons, and parentheses.
🚀 Application
expert
2: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?
A90
B45
C100
D50
Attempts:
2 left
💡 Hint
Calculate steps by proportion: (desired angle / 360) * total steps.