Top Banner
Introduction to Arduino & Programming language By C. Vamshi Krishna Department of Electronics & Communication Engineering GITAM School Of Technology GITAM University Bengaluru Campus
26

Aurdino presentation

Jan 25, 2017

Download

Devices & Hardware

C.Vamsi Krishna
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Aurdino presentation

Introduction to Arduino &

Programming language

By C. Vamshi KrishnaDepartment of Electronics & Communication Engineering GITAM School Of Technology GITAM University Bengaluru Campus

Page 2: Aurdino presentation

What is arduino?

Page 3: Aurdino presentation

What is arduino?Arduino is an open-source prototyping platform

based on easy-to-use hardware and software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output - activating a motor, turning on an LED, publishing something online. 

Page 4: Aurdino presentation

What is arduino? In General, we use the Arduino programming

language (based on Wiring) and the Arduino Software (IDE), based on Processing.

Page 5: Aurdino presentation

Why arduino?Arduino has been used in

thousands of different projects and applications. 

The Arduino software is easy-to-use for beginners.

It runs on Mac, Windows, and Linux. 

Programming language is easy.

Page 6: Aurdino presentation

Advantages over microcontrollersArduino boards are relatively inexpensive

compared to other microcontroller platforms.The Arduino Software (IDE) runs on Windows,

Macintosh OSX, and Linux operating systems. Most microcontroller systems are limited to Windows.

Page 7: Aurdino presentation

How to start?1.Check out:

http://arduino.cc/en/Guide/HomePage2. Download & install the Arduino

environment (IDE)3.Connect the board to your computer via the

USB cable4.Install the drivers for arduino board5.Launch the Arduino IDE6.Select your board, serial port, processor.7.Open the blink example 8. Upload the program

Page 8: Aurdino presentation

Arduino IDE

Page 9: Aurdino presentation

Selecting arduino board

Page 10: Aurdino presentation

Selecting the processor

Page 11: Aurdino presentation

Selecting the serial port

Page 12: Aurdino presentation

Using the arduino

Page 13: Aurdino presentation

Example arduino code

Page 14: Aurdino presentation

Checking the outputPress the upload button on the

top of the software.Open the serial monitor to see

the output.

Page 15: Aurdino presentation

Status messages

Page 16: Aurdino presentation

What is arduino programming?Arduino consists of both a physical

programmable circuit board and a piece of software, or IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board.

An open-source hardware platform based on an Atmel AVR 8-bit microcontroller and a C++ based IDE

Over 300000 boards have been manufacturedArduino Due is based on a 32-bit ARM Cortex

Page 17: Aurdino presentation

Important functionsSerial.println(value);

◦Prints the value to the Serial Monitor on your computer

pinMode(pin, mode);◦Configures a digital pin to read (input) or write

(output) a digital valuedigitalRead(pin);

◦Reads a digital value (HIGH or LOW) on a pin set for input

digitalWrite(pin, value);◦Writes the digital value (HIGH or LOW) to a pin

set for output

Page 18: Aurdino presentation

How arduino program runs?

Arduino programs run on two basic sections.

void setup() {

//setup motors, sensors etc

} void loop() {

// get information from sensors // send commands to motors

}

Page 19: Aurdino presentation

SET UPThe setup section is used for

assigning input and outputs (Examples: motors, LED’s, sensors etc) to ports on the Arduino

It also specifies whether the device is OUTPUT or INPUT

To do this we use the command “pinMode”

Page 20: Aurdino presentation

void setup() { pinMode(9, OUTPUT); } Input or output

port #

Page 21: Aurdino presentation

void loop() { Port # from setup

digitalWrite(9, HIGH); delay(1000); digitalWrite(9, LOW); delay(1000);

} Wait for 1 second or 1000 milliseconds

Wait for 1 secondor 1000 milliseconds

Port # from setup

Turn the LED on or off

Page 22: Aurdino presentation

How LED blinks? void setup() { pinMode(77, OUTPUT); //configure pin 77 as output

} // blink an LED once void blink1() { digitalWrite(77,HIGH); // turn the LED on delay(500); // wait 500 milliseconds digitalWrite(77,LOW); // turn the LED off delay(500); // wait 500 milliseconds }

Page 23: Aurdino presentation

How to create infinite loops?void loop() //blink a LED repeatedly{digitalWrite(77,HIGH); // turn the LED on

delay(500); // wait 500 millisecondsdigitalWrite(77,LOW); // turn the LED off

delay(500); // wait 500 milliseconds}

Page 24: Aurdino presentation

Reading data from arduinovoid setup(){Serial.begin(9600);}void serialtest(){int i;for(i=0; i<10; i++)Serial.println(i);}

Page 25: Aurdino presentation
Page 26: Aurdino presentation