routines
pinMode and digitalWrite
Debug
Misc. Q's
random()
100
What are the names of the 2 routines found in an Arduino Sketch?
void setup() and void loop()
100
In which routine is the pinMode() function?
void setup()
100
digitalwrite(6,HIGH);
digitalWrite - missing capital W
100
What does 100 mean in the following code? delay(100);
stop running all code for 10 milliseconds.
100
What is the set of numbers that might be used with this statement? random(5)
1,2,3,4,5
200
Which routine comes first?
setup() is first and loop() is second
200
what does the number 6 do in this piece of code: pinMode(6,INPUT);
The code tells the arduino to use port 6, in this case for receiving input from the circuit.
200
pinMode(6,OUTPUT)
missing semicolon ; at end of line
200
Debug this line of code: digitalWrite(7,high);
digitalWrite(7,HIGH); HIGH should be in capitals
200
What does the delay function do for the LED in the following code? digitalWrite(9,HIGH); delay(random(1000));
It pauses the program to leave the light on for 1000 milliseconds or 1 second.
300
Which routine repeats itself over and over again?
void loop()
300
What does LOW do in the following code: digitalWrite(7,LOW);
LOW turns the voltage off for pin 7
300
void loop() ;
routines do not have semicolons to end the line
300
What function creates/initiates a connection with one of the pins on the arduino board?
pinMode()
300
Debug this code: delay(random(500);
delay(random(500)); missing second ending parenthesis
400
What is the last code written for the void loop() routine?
The ending bracket }
400
If I want to use three different ports on my arduino to make three lights go on and off, how many pinMode functions do I need?
Three
400
/This program will make an LED blink
comments will have two slashes //
400
Do you need the void loop() routine?
Yes, every sketch must have void loop() and the void setup().
400
What is the solution set to the following code: random(100,500)
any number between 100 and 500
500
Why do we write // at the beginning of the arduino sketch?
// is a comment, we write them at the beginning to let the programmer know what the code should do.
500
Which command turns on and off electricity to my circuit with the LED?
digitalWrite()
500
delay(200)
Missing semicolon ; to end line
500
With your team draw a diagram of the wiring for one LED, a bread board, a resistor and the arduino.
See team diagrams...
500
When can you use a random statement like this: digitalWrite(random(3,5),HIGH);
The random statement will chose between 3,4,5. These are the choices for the pins on the arduino board. If the arduino board has LED's attached to pins 3,4,5 then you can randomly want to turn one of the 3 LED's on.
M
e
n
u