Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set pin 2 as an output.
Arduino
pinMode([1], OUTPUT); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a pin number not connected to the display.
✗ Incorrect
Pin 2 is the correct pin to set as output for the seven-segment display control.
2fill in blank
mediumComplete the code to turn on segment A by setting pin 2 HIGH.
Arduino
digitalWrite([1], HIGH); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a pin number not connected to segment A.
✗ Incorrect
Pin 2 controls segment A, so setting it HIGH turns it on.
3fill in blank
hardFix the error in the code to turn off segment B connected to pin 3.
Arduino
digitalWrite([1], LOW); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong pin number for segment B.
✗ Incorrect
Pin 3 controls segment B, so setting it LOW turns it off.
4fill in blank
hardFill both blanks to create a function that turns on segment C connected to pin 4.
Arduino
void turnOnSegmentC() {
digitalWrite([1], [2]);
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the pin to LOW instead of HIGH.
Using the wrong pin number.
✗ Incorrect
Pin 4 controls segment C, and setting it HIGH turns it on.
5fill in blank
hardFill all three blanks to create a function that turns off segments D and E connected to pins 5 and 6.
Arduino
void turnOffSegments() {
digitalWrite([1], [2]);
digitalWrite([3], LOW);
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting pins to HIGH instead of LOW.
Using wrong pin numbers.
✗ Incorrect
Pin 5 and pin 6 control segments D and E. Setting them LOW turns them off.
