Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAURABH GINGADE.

Similar presentations


Presentation on theme: "SAURABH GINGADE."— Presentation transcript:

1 SAURABH GINGADE

2

3 Usually it is this

4 The Difference

5 Prerequisites

6 Proper Handling - by the edges!!!

7 The IDE Of an Arduino

8 Lets get to coding Turn LED ON Wait Turn LED OFF Rinse & Repeat

9

10 Three commands to know…
pinMode(pin, INPUT/OUTPUT); ex: pinMode(13, OUTPUT); digitalWrite(pin, HIGH/LOW); ex: digitalWrite(13, HIGH); delay(time_ms); ex: delay(2500); // delay of 2.5 sec. // NOTE: -> commands are CASE-sensitive

11 Two required functions / methods / routines:
void setup() { // runs once } void loop() // repeats

12 Structure of an Arduino Program
/* Blink - turns on an LED for DELAY_ON msec, then off for DELAY_OFF msec, and repeats BJ Furman rev Last rev: 22JAN2011 */ #define LED_PIN // LED on digital pin 13 #define DELAY_ON 1000 #define DELAY_OFF 1000 void setup() { // initialize the digital pin as an output: pinMode(LED_PIN, OUTPUT); } // loop() method runs forever, // as long as the Arduino has power void loop() digitalWrite(LED_PIN, HIGH); // set the LED on delay(DELAY_ON); // wait for DELAY_ON msec digitalWrite(LED_PIN, LOW); // set the LED off delay(DELAY_OFF); // wait for DELAY_OFF msec An arduino program == ‘sketch’ Must have: setup() loop() configures pin modes and registers runs the main body of the program forever like while(1) {…} Where is main() ? Arduino simplifies things Does things for you This slide is meant as a quick overview of an Arduino sketch. We’ll unpack and describe the pieces in more detail later. Think of setup() as what you would do when you first get in a rental car or a car you have borrowed from a friend: adjust the mirrors, adjust the steering wheel, the seats, change the stereo channel settings, etc. The car can be driven by anyone, but everyone likes to customize it for their comfort. main() {    init();    setup();    while (1)       loop(); } And the reason that they do it this way is so it's guaranteed that init() gets called, which is critical for Arduino initialization.

13 To get a digital reading:
Digital Input needs a pinMode command: pinMode (pinNumber, INPUT); Make sure to use ALL CAPS for INPUT To get a digital reading: int buttonState = digitalRead (pinNumber);

14 void loop() { int buttonState = digitalRead(5); if(buttonState == LOW) { // do something } else { // do something else

15 Setting the serial port

16 Checking the Right Board

17 Compiling and Uploading Code
Write the code Compile the code Check Arduino Port Connection Upload the Code The Arduino and Connected Circuits start to show behavior based on the uploaded code

18 The ARDUINO MINI PRO

19 Specifications

20 Pin layout

21

22

23

24

25 Thats all folks


Download ppt "SAURABH GINGADE."

Similar presentations


Ads by Google