0
0
Arduinoprogramming~10 mins

Documentation and pin mapping 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 LED pin number.

Arduino
const int ledPin = [1];
Drag options to blanks, or click blank then click option'
AHIGH
BdigitalWrite
CINPUT
D13
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name instead of a pin number.
Using a constant like HIGH or INPUT instead of a pin number.
2fill in blank
medium

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

Arduino
void setup() {
  pinMode([1], OUTPUT);
}
Drag options to blanks, or click blank then click option'
AledPin
BINPUT
CdigitalWrite
DHIGH
Attempts:
3 left
💡 Hint
Common Mistakes
Using a constant like INPUT instead of the pin variable.
Using a function name instead of a pin number.
3fill in blank
hard

Fix the error in the code to turn the LED on.

Arduino
void loop() {
  digitalWrite([1], HIGH);
}
Drag options to blanks, or click blank then click option'
AledPin
BINPUT
CLOW
DpinMode
Attempts:
3 left
💡 Hint
Common Mistakes
Using INPUT or pinMode instead of the pin variable.
Using LOW instead of HIGH to turn the LED on.
4fill in blank
hard

Fill both blanks to create a comment documenting the LED pin number.

Arduino
// [1] is connected to pin [2]
Drag options to blanks, or click blank then click option'
ALED
Bbutton
C13
D7
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the LED with the button.
Using the wrong pin number in the comment.
5fill in blank
hard

Fill all three blanks to create a dictionary mapping pin names to pin numbers.

Arduino
const int pins[] = { [1], [2], [3] };
Drag options to blanks, or click blank then click option'
AledPin
BbuttonPin
C13
D7
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of pin numbers.
Repeating the wrong pin numbers.