Arduino: Ders 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

ARDUINO

DERS 2

Adopted from edx


HOW TO CODE?

• Understanding the Problem


• Finding a Solution Flowchart
• Coding
• Testing the Code
• Debugging (If Required)
FLOWCHART

• Understanding the problem


• Breaking down into valid steps
• Reviewing conditions (if available)
• Appropriate processing and output.
FLOWCHART

• An event as simple as eating food, sitting on a chair, etc. can be represented


using flowchart.
• Using it we can break down the process into simpler sub-processes, eventually
helping us with coding.
• In the beginning it might be confusing, time consuming and useless as well, but
once well acquainted to it, it shall be of great help.
THINGS YOU NEED FOR THIS COURSE
• Arduino UNO R3
• Breadboard
• Jump leads
• LEDs
• Resistors
• LDR/Photoreistor
• Push Button
• Potentiometer
• Piezo Buzzer
• Mini Servo Motor
• Optional: 16x2 LCD
SOFTWARES FOR WRITING AND TESTING CODES
1. The Arduino IDE is the preferred tool to use with the Arduino board, as it allows you
to upload code to your Arduino board via USB. This software requires installation on
your Windows, Linux or Mac computer.
2. Finally, TinkerCad by Autodesk allows us to create and simulate circuits on a
browser! This even requires no installation.
HOW TO INSTALL ARDUINO IDE?

• Go to www.arduino.cc
• Under Downloads tab, go for Software.
• Download an appropriate Arduino IDE for your platform.
• Install the downloaded file.
• Open Blink from examples and try loading it to your Arduino.
TINKERCAD CIRCUITS

• https://www.tinkercad.com/circuits
• It requires an AutoDesk account which can be created by getting registered
to the website.
• You can simulate the circuit by drawing it and loading the code to the Arduino.
BLINK EXAMPLE
CODE
• Blocks:
• setup
• loop
• Functions
• Name
• Inputs as Parameters or Arguments
• Output
• pinMode sets the specified pin to be an input our output (in this case we pass
OUTPUT as the second parameter
pinMode(led,OUTPUT);
• digitalWrite Setting a specified pin OUTPUT status.
digitalWrite(led, HIGH);
• delay pauses the program for a number of milliseconds (thousandths of a second)
which is passed as its parameter:
delay(1000);
SIMULATION

• TinkerCAD

Next Week Quiz


Questions?

You might also like