Professional Documents
Culture Documents
TinkerCAD - Intro To Ardunio - Official Module - Student
TinkerCAD - Intro To Ardunio - Official Module - Student
Embedded System
Agenda
Day Time Agenda
New project
Past project
Project name Tinkercad interface
Building components
1 Rotate
2 Delete
3 Undo/Redo
4 Comment
5 View/Hide
6 Wire Color
7 Wire Type
Programming area
Arduino type
3 STEPS TO PROGRAM AN ARDUINO:
3 Start Simulation
ARDUINO UNO
EMBEDDED SYSTEM
INTRODUCTION
COMPONENTS
4 Resistor 10kΩ
5 Piezo (Buzzer)
INTRODUCTION
OHM’S LAW
INTRODUCTION
HOW TO USE A BREADBOARD
INTRODUCTION
LED POLARITY
PROJECT 1: STROBE LIGHT
Troubleshooting Tips
Project 1:
Red Red Brown or 220 Ω
strobe light
Short Leg
Lets do it together…
Wait 1 second
End
Setup
OUTPUT tells Arduino that this
pin is an output pin
Programming error
Hardware error
PROGRAMMING ERROR Source of
Error indication error
Error indication
HARDWARE ERROR
No orange line appears, but still your project does not work
Refer back to your circuit
Quiz Time! Let’s play Kahoot!
1. Get another device and go to www.kahoot.it
2. Select Play
3. Key in the Game PIN
4. Questions will appear on the laptop screen.
5. You need to answer the quiz through your another device.
PROJECT 2: RUNNING LED
Resistors
Light up the LED in sequence...
Project 2: Running LEDs
(20 minutes)
Software
1 2
How to read a
resistor colour code?
Software
Change to different
delay and tone values
and observe the
behaviour of your
circuit…Give it a try!
Fill in the
blanks
tone(pin, frequency)
To use it, you only need to tell the pin, which pin
the buzzer is connected to and which frequency
(in Hertz) you want.
Continue..
if, else (Conditional statement)
You want to execute a block of code only if a particular condition is true. For example, you may want
to light an LED if a switch is pressed or if an analog value is greater than some threshold.
The if…else statement works as follows when the condition is tested true:
• statements inside the brackets of the if are executed when the condition is true
• statements inside the brackets of the else are skipped
The if…else statement works as follows when the condition is tested false:
• statements inside the brackets of if are skipped
• statement inside the brackets of else are executed.
Inside the parentheses, you can use various operators. The comparisons you can use are listed below.
• x ! = y ( x not equal to y )
• x < y ( x less than y )
• x > y ( x greater than y )
• x == y ( x equal to y )
• x < = y ( x less than or equal to y )
• x > = y ( x greater than or equal to y )
PROJECT 5: TOUCH MUSICAL FAN LEDs
Bonus: DC Motor
Project 5: Touch Musical Fan LEDs
(Bonus)
Continue..
Congratulation!
Closing
Thank you!
APPENDICES
"include"
"include" used starting code and include libraries into sketch.
"function"
• group code create name of function. For example, getMaximum().
• purpose of code in function getMaximum() return max value.
• function with () to identify is function/variable.
"return“
• Used in last line code in function.
• If function type is void, then no need return.
• If function type is integer, function return integer/ cannot compile
APPENDICES
"variable"
• Hold value in program.
• Variable name unique in entire system.
• Cannot have duplicate same variable names in code.
"declare“
• Assign data type to variable.
• Data type: int, char, string, double, float, bool.
• For example: int number; variable named "number" as 'integer’.
“initialize“
• Assign initial value to variable.
• For example, int number = 5; variable "number" is 'integer' hold value '5’.