wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Arduino - Exercise 5 Simple Digital Input

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Select one. Digital inputs .....

a)

can be one of three states, HIGH, LOW and MIDDLE

b)

can turn on LED's

c)

can be only one of two states, HIGH or LOW

d)

Can be a wide range of values.

2.

True or False. We use a pull down resistor for digital inputs to ensure the input is held LOW when the switch is off.

a)

True

b)

False

3.

A constant is ....

a)

A number that changes

b)

A number that stays the same

c)

A number that is always 0

4.

A variable is ....

a)

A number that changes

b)

A number that stays the same

c)

A number that is always 0

5.

Which command is correct for initialising pin 7 as an INPUT.

a)

pinmode (7, OUTPUT);

b)

pinMode (7, INPUT);

c)

pinMode (7, INPUT)

d)

pinmode(7, HIGH);

6.

Which command would read the digital input on pin 7?

a)

digital read (7, INPUT);

b)

digitalRead(7, INPUT)

c)

digitalRead(7,INPUT);

d)

digitalRead(7, OUTPUT);

7.

If digital input pin 4 was LOW and we wanted the variable 'switchstate' to store that value, which is the correct command.

a)

switchstate = digitalRead (4);

b)

switchstate = digitalRead (7);

c)

switchstate = digitalRead (4)

d)

switchstate = digitalread (4);

8.

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);

a)

HIGH

b)

LOW

c)

MIDDLE

d)

This command is written incrrectly.

9.

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);

a)

HIGH

b)

LOW

c)

Unsure as its reading pin 3 not pin 8

d)

This command is written incorrectly.

10.

What does the 'else' command do?

a)

Nothing

b)

Always does the else commands even if the previous 'if' statements were true

c)

Only does the else commands if none of the other 'if' conditions were true