aurdino presentation

Post on 25-Jan-2017

56 Views

Category:

Devices & Hardware

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Introduction to Arduino &

Programming language

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

What is arduino?

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. 

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

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

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.

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.

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

Arduino IDE

Selecting arduino board

Selecting the processor

Selecting the serial port

Using the arduino

Example arduino code

Checking the outputPress the upload button on the

top of the software.Open the serial monitor to see

the output.

Status messages

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

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

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

}

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”

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

port #

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

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 }

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}

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

top related