Monday, 4 February 2019

Arduino basic: part II




POWERING

Whenever you buy an Arduino, the blink programme is preinstalled. So when you plug-in the Arduino through USB cable ( or by power adapter, but USB preferable), the light of the Arduino( specified with L on the board) start blinking, if not blinking then check USB connection or the board. ( In some Arduino boards the instead of blinking the On LED gets on)

The LED L is connected internally with the digital pin 13 and the USB needed is type-A-to-type-B USB lead.

SOFTWARE INSTALLATION

To upload the sketch (that is what you want to do through the Arduino board in Arduino lang.), you need to download the Arduino IDE software to your computer.

Search www.arduino.cc and you will get the app or zip file in the download section. After installation you will get a page like this.
Arduino IDE



FIRST SKETCH

The blinking of the LED is just basic level sketch. When you open the Arduino IDE app then you will get an empty sketch (as shown above). The sketch you write inside the Setup() function that will run once and what you write inside the loop() function, it will run again and again.

You can have the bink sketch from the example. For this click on the FileàExampleàBasicàBlink



Then you have to select the type of board you are using. For this click on the ToolàBoardà(type of Board)



The select the port you are using by clicking ToolàPortà(port using)

Then click on the for compilation and click on this for uploading the sketch to the Arduino board.

ANALYSIS OF 1ST SKETCH

sketch

First of all define the LED_BULTIN pin with a digital pin ( we are using 13 because of inbuilt features of the board).

Then inside the pinMode(_,_); in the first part write the pin you are working with and in the second part write the mode, that is since here it is an LED we are using and it is an OUTPUT type, so we write OUTPUT there. If we are dealing with switch then we write INPUT there.

Inside the loop() function, in the digitalWrite(_,_);  we write in the 1st part the pin and in the 2nd part what we want, that is HIGH means supplying of 5V, light on and LOW means no power supply, light off.

And inside delay(_); we write the time for which we want delay the performance. Here 1000=1 second.

CONCLUSION

You can save the sketch and have it again by clicking Fileà Sketchbook

I think you get understand this part. If anything you find here is misleading or not clear, then surely ask me.

The next part with moderate level sketch will be uploaded here soon.

No comments:

Post a Comment