Bird
0
0
Arduinoprogramming~10 mins

Servo motor control with Servo library 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 include the Servo library.

Arduino
#include [1]
Drag options to blanks, or click blank then click option'
A<Servo.h>
B<Servo>
C"Servo.h"
D<servo.h>
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes instead of angle brackets
Incorrect capitalization of 'Servo.h'
Omitting the #include directive
2fill in blank
medium

Complete the code to create a Servo object named myServo.

Arduino
Servo [1];
Drag options to blanks, or click blank then click option'
Amotor
BmyServo
CservoMotor
Dservo
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different object name
Missing the semicolon
Using a reserved keyword as the name
3fill in blank
hard

Fix the error in attaching the servo to pin 9.

Arduino
myServo.[1](9);
Drag options to blanks, or click blank then click option'
Aconnect
Bbegin
Cattach
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using connect instead of attach
Using begin or start which are not Servo methods
Omitting the pin number
4fill in blank
hard

Fill both blanks to write the servo to 90 degrees inside loop.

Arduino
void loop() {
  myServo.[1]([2]);
}
Drag options to blanks, or click blank then click option'
Awrite
B90
Cattach
D45
Attempts:
3 left
💡 Hint
Common Mistakes
Using attach instead of write
Using 45 instead of 90
Omitting the angle value
5fill in blank
hard

Fill all three blanks to create a servo, attach it to pin 10, and write 180 degrees.

Arduino
Servo [1];

void setup() {
  [1].[2](10);
  [1].write(180);
}
Drag options to blanks, or click blank then click option'
Aarm
Battach
CmyServo
Dwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using different object names inconsistently
Using wrong method names like connect or start
Forgetting to attach before writing