Bird
0
0
Arduinoprogramming~10 mins

Stepper motor with driver module in Arduino - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the step pin for the stepper motor driver.

Arduino
const int stepPin = [1];
Drag options to blanks, or click blank then click option'
A12
B3
C9
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using a pin number not connected to the step input of the driver.
2fill in blank
medium

Complete the code to set the direction pin as an output in the setup function.

Arduino
void setup() {
  pinMode([1], OUTPUT);
}
Drag options to blanks, or click blank then click option'
AstepPin
BledPin
CenablePin
DdirPin
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the wrong pin as output or forgetting to set the pin mode.
3fill in blank
hard

Fix the error in the loop to make the motor step correctly.

Arduino
digitalWrite(stepPin, HIGH);
delay([1]);
digitalWrite(stepPin, LOW);
delay(1);
Drag options to blanks, or click blank then click option'
A10
B1000
C0
D-10
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero or negative delay causing no movement or errors.
4fill in blank
hard

Fill both blanks to complete the code that sets the motor direction and steps it.

Arduino
digitalWrite([1], HIGH);
digitalWrite([2], HIGH);
delay(10);
Drag options to blanks, or click blank then click option'
AdirPin
BstepPin
CenablePin
DledPin
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing stepPin and dirPin or using unrelated pins.
5fill in blank
hard

Fill all three blanks to create an array holding the pin numbers for stepPin, dirPin, and enablePin.

Arduino
const int pins[] = { [1], [2], [3] };
Drag options to blanks, or click blank then click option'
AstepPin
BdirPin
CenablePin
DledPin
Attempts:
3 left
💡 Hint
Common Mistakes
Including unrelated pins like ledPin or missing one of the motor control pins.