Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set pin 5 to HIGH.
Embedded C
digitalWrite(5, [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LOW instead of HIGH will turn the pin off.
Using INPUT or OUTPUT in digitalWrite is incorrect.
✗ Incorrect
To set a pin to HIGH, use the constant HIGH in the digitalWrite function.
2fill in blank
mediumComplete the code to set pin 3 to LOW.
Embedded C
digitalWrite(3, [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using HIGH will turn the pin on instead of off.
Using INPUT or OUTPUT is wrong in digitalWrite.
✗ Incorrect
To turn off the pin, use LOW in digitalWrite.
3fill in blank
hardFix the error in setting pin 7 to HIGH.
Embedded C
digitalWrite([1], HIGH); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting HIGH as the pin number causes errors.
Using OUTPUT or LOW as pin number is incorrect.
✗ Incorrect
The first argument of digitalWrite must be the pin number, here 7.
4fill in blank
hardFill both blanks to set pin 9 as output and then write HIGH to it.
Embedded C
pinMode([1], [2]); digitalWrite(9, HIGH);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LOW or INPUT in pinMode instead of OUTPUT.
Using wrong pin number.
✗ Incorrect
Use pinMode(9, OUTPUT); to set pin 9 as output before writing HIGH.
5fill in blank
hardFill all three blanks to set pin 4 as output, write LOW, then write HIGH.
Embedded C
pinMode([1], [2]); digitalWrite(4, [3]); digitalWrite(4, HIGH);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using INPUT instead of OUTPUT in pinMode.
Writing HIGH instead of LOW in the second digitalWrite.
✗ Incorrect
First set pin 4 as output with pinMode(4, OUTPUT);, then write LOW to turn it off, then HIGH to turn it on.