You are on page 1of 5

ThinkerShield

Activity: Identify each of the components on the ‘ThinkerShield’ as either input, output or expansion.

Input
Expansio
n
Output

Output
Input

Expansio
m

Expansion

Word bank
 Input
 Output
 Expansion

The Arduino microcontroller


Activity: Identify each of the components on Arduino microcontroller using the words from the Word bank.
Digital Output/Input
Reset

USB
PCB

On Board
LED
Power Light Micro
Controller
Dc Power

Analogue Input

Word bank

 Analogue input pins  On-board LED


 Digital input/output pins  Power light
 DC Power connector  Printed Circuit Board (PCB)
 Microcontroller  Reset button
  USB port

ARDUINO SKETCH

Label the components of the Arduino sketch and program

Title
Uploa
d
Verify Serial

Comm
ents
Semi
Colon
Comm Brace
and Open

Brace
Close
d
Debug

Status
Bar
© ARDUINO LLC 2016 - CC-BY-SA 3.0

Word bank

 Command  Semi colon


 Comments  Sketch title
 Curly brace close  Status bar
 Curly brace open  Upload
 Debug area  Verify command
 Serial Monitor

Sketch Explanation of the components of the sketch.


- Commands/Keywords: These appear in orange and have a specific meaning in Arduino
language eg Integer command
- Comments: These appear in grey and are written in plain English to allow a person to
understand the code easily
- Void set setup: where the rules are set up for the sketch
- Void loop: details of the commands that will repeat themselves (unless the power runs out)
- Semicolon, curly braces and brackets: syntax for the code (grammar and punctuation)
- Status Bar: displays the progress of the sketch upload
- De bugger Area: displays information about errors in the sketch
Program layout and structure for Arduino
Arduino programs can be divided into three main parts: ‘structure’, ‘values’ (variables and constants), and ‘functions’.

Spelling and grammar in coding – syntax


When coding, the spelling and grammar (syntax) you use must be absolutely correct. If you have any aspect of the
code incorrect the computer will not know what to do, or will do the “wrong” thing.
Camel case is used when words are joined together and use a capitalised letter to show separation. Commands in
code are case sensitive.

Component Function
Commands Are an instruction given in a program that tells the computer to do something
specific. The main ones we will work with are keywords.
Semicolon ; To tell Arduino it is at the end of that line of code.

Serial monitor To allow you to see what the program is doing “in the background” even if your
circuit doesn’t appear to be working. Serial monitor is a good way to check your
code is correct/working.
Void setup This section of code initially runs once when the program is run, and is used to tell
Arduino what to expect its input/output pins to be doing or connected to.
Void loop This section of code runs over and over until the power is switched off or the
program has an ending statement.
Curly braces { } These begin and end sections of code and Arduino needs them to recognise
“paragraph structure” in your program.
Comments Are put into the program to remind the programmer or tell someone else looking at
the program what is happening in that line or section of code.
Verify program This function checks your code for errors and highlights any errors in the code so
you can fix them before uploading to your board.

Activity:
Write three review questions about the Arduino microcontroller and ThinkerShield for your partner to answer.
1. Where is the reset button on the Arduino Uno?

2. What symbol should be after every code on Arduino

3. How many inputs are on the ThinkerShield?

Rewrite the following code finding the errors


The blink sketch
void setup( { // the setup function runs once when you press reset or power the board
pinMode(8, PUT); // initialize digital pin 12 as an output.
pinMode(12, OUT PUT);
}
void loop) { // the loop function runs over and over again forever
digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000) // wait for a second
digitalWrite(10, HIGH); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
digitalWrite(12, HIGH) // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digital(12, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

Crack the Code Evaluation of PRP#01- Blink Code

Were you successful at getting the LED to blink?


Yes
____________________________________________________________________________________________

Explain how you were able to change the code and get the blink rate to change?
By Changing the Outputs and delay times to higher or lower numbers depending how we wanted it

___________________________________________________________________________________________________

Explain how you were you able change the code and get the LEDs to flash in the pattern that you wanted?
We changed the order of the outputs to what we desired.

___________________________________________________________________________________________________

Write two things you have learnt so far about coding using Arduino.
1. To write codes that execute a command for blinking LEDs

2. To create and code and a simple circuit for a breadboard with LED
___________________________________________________________________________________________________

___________________________________________________________________________________________________

___________________________________________________________________________________________________

How could you improve your coding skills, based on what you currently know?

We already know the basics so learning more of the advanced codes would be beneficial to our
progress. One thing we could've done better is writing the codes more efficiently and quickly.
___________________________________________________________________________________________________

___________________________________________________________________________________________________

___________________________________________________________________________________________________

___________________________________________________________________________________________________

___________________________________________________________________________________________________

You might also like