NEW
Font size
WorksheetsArduino - Exercise 5 Simple Digital Input
Total questions: 10
Worksheet time: 5mins
Select one. Digital inputs .....
can be one of three states, HIGH, LOW and MIDDLE
can turn on LED's
can be only one of two states, HIGH or LOW
Can be a wide range of values.
True or False. We use a pull down resistor for digital inputs to ensure the input is held LOW when the switch is off.
True
False
A constant is ....
A number that changes
A number that stays the same
A number that is always 0
A variable is ....
A number that changes
A number that stays the same
A number that is always 0
Which command is correct for initialising pin 7 as an INPUT.
pinmode (7, OUTPUT);
pinMode (7, INPUT);
pinMode (7, INPUT)
pinmode(7, HIGH);
Which command would read the digital input on pin 7?
digital read (7, INPUT);
digitalRead(7, INPUT)
digitalRead(7,INPUT);
digitalRead(7, OUTPUT);
If digital input pin 4 was LOW and we wanted the variable 'switchstate' to store that value, which is the correct command.
switchstate = digitalRead (4);
switchstate = digitalRead (7);
switchstate = digitalRead (4)
switchstate = digitalread (4);
If the switch connected to digital pin 3 was on, what would the value of the variable 'switchstate' be in the command
switchstate = digitalRead(3);
HIGH
LOW
MIDDLE
This command is written incrrectly.
If the switch connected to digital pin 8 was off, what would the value of the variable 'switchstate' be in the command
switchstate = digitalRead(3);
HIGH
LOW
Unsure as its reading pin 3 not pin 8
This command is written incorrectly.
What does the 'else' command do?
Nothing
Always does the else commands even if the previous 'if' statements were true
Only does the else commands if none of the other 'if' conditions were true
