Getting Started with Arduino

Arduino Basics


Ok in this post i am not going to tell what is arduino what it does and blah blah we will directly jump into action.

Overview

How it looks obviously you are reading it that means you are having it already if not buy it from amazon , eBay or from anywhere it is a revolutionary piece buy it. I am having a Arduino Pro min 5V it is a smaller version of Uno board trust me all the boards are "here and there same"(only number of pins and Atmega version changes) 
Arduino Pro Mini 3.3V
Arduino Pro min 5v 

How to Program it ?

Buy an FTDI or any USB to serial adapter I have FT232RL trust me it is good one drivers are readily available online for all the OS  here . Here is how it looks 


FT232RL USB to Serial Adapter

  • How to Connect it ?

    Just put both the boards on bread-board facing each other just make sure both the DTR pins are aligned in same direction. Some clones of arduino might be having the the order of programming pins in the some other order just make sure all the pins are in same order as the FTDI. At this point if you don't have a breadboard buy one or you can use the normal female to female breadboard jumper cables. Here is how to put both of them together.

Easiest way to connect the two boards

a word of caution

By default this FTDI gives 5v so if your board isn't a 5v one change the voltage of the FTDI using the key just pull it out and push it in the other two pins. This will make it 3.3v, a multimeter will be handy to check the voltages else it will blow your 3.3v board.


About the Arduino IDE

Download the latest the version of Arduino IDE from here . Once downloaded and installed run the blink example. Figuring out where to find it see below:

where to find the blink example

How to deploy the code ?

how to deploy the code

What is this code ?

void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

Explanation:

About the two methods:
void setup()  //this runs only once during the programs lifetime
void loop()   //this runs forever in the board but after the setup method is executed


  • inside the setup() mode:
    • calling the pinMode() function it sets the pin number 13 and setting it as an output pin

  • inside the loop() mode:
    • calling the digitalWrite() function it sets the voltage of pin 13 as HIGH
    • delay(1000) function delays the execution of forthcoming commands.
    • simillary the next command again sets the voltage of pin 13 as LOW.

Ok some light is flashing on the board this is because the LED is attached to pin 13. Thus it keeps blinking.


Right board is arduino and it is flashing the attached LED


That's it for the basics 





Deepankar

My Name is Deepankar Agrawal. A lover of new technologies and i like tinkering with new device and softwares. Hope You are enjoying the tutorials of Raspberry pi. Feel free to contact me :)

No comments:

Post a Comment