Font size
WorksheetsArduino- Exercise 4 Random Dice
Total questions: 10
Worksheet time: 5mins
These are schematic symbols for a _____________
LED
Microcontroller
Resistor
Slide switch
A variable is a number that ____________
Changes
Stays Constant
When declaring a long variable we use the command _______
int
var
long
const
Where in an Arduino sketch (programme code) do we declare variables and constants?
At the end of the code
At the top of the code
Anywhere in the code
random generates what type of numerical data?
variable
constant
When deciding on variable names we use names that explain what is being stored. If we wanted do declare a 'long' variable that had something to do with light levels which name would you choose?
switchstate
randomlight
lightlevel
temperaturereading
If we wanted a random number between 1 and 6, what command would we use?
random (1, 6);
random (1,7);
Random (1, 8);
If we wanted a random number between 2 and 10, what command would we use?
random (2, 10);
random (2,11);
Random (1, 10);
'if' is what type of command?
declaration
process
conditional/decision
input/output
Tick the errors with this 'if' statement which displays 1 if random number selected is 1
if (randDice = 1){
digitalWrite(7, LOW);
digitalWrite(8, LOW);
DigitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(12, LOW);
digitalWrite(13, LOW);
{
'if' is incorrectly written
There should be two = signs used in 'if' statements.
Closing curly bracket is the wrong way
One of the digitalWrite commands is incorrectly written
Two of the digitalWrite commands is incorrectly written
