Welcome to next Arduino tutorial. If you have not read the previous tutorial i request to read them. Now we are learning “How to use and Program Arduino”
Interface your Arduino to the PC with the USB link. You needn’t bother with the battery until further notice. The green PWR LED will light. In the event that there was at that pin a project into the Arduino, it will run.
Warning: Don’t put your Arduino on a conductive surface when it is powered on. It may short and damage the Circuit.
Begin the Arduino advancement environment. In Arduino projects are called “sketches“,but here we will simply call them programs. In the altering window that surfaces, enter the accompanying project, paying consideration on where semi-colons show up toward the end of summon lines.
Your program sketch looks like this
Then click on Upload button to compile sketch and to load on our Arduino UNO. After that click on Serial Monitor button. If all has gone right it will shows “Hello World” Message.
Congrats; you have made and run your first Arduino program!!
Not worked here are some Troubleshooting Steps:
If there is a syntax error in the program caused by a mistake in typing, an error message will appear in the bottom of the program window. Generally, staring at the error will reveal the problem. If you continue to have problems, try these ideas
If there is any code error in the written program caused by a mistake, Arduino IDE shows error on the bottom side of the window.If your problem persists you can try these
Run the Sketch again
Checkout the cable is fixed properly or not.
Restart your PC and check.
The Arduino runs an improved adaptation of the C programming , with a few augmentations for getting to the equipment. In this aide, we will cover the subset of the programming dialect that is most helpful to the fledgling Arduino planner.
All Arduino guidelines are one line. The board can hold a system many lines long and has space for around 1,000 two-byte variables. The Arduino executes programs at around 300,000 source code lines for each sec.
Creating a #Program
Projects are made in the Arduino improvement environment and afterward downloaded to the Arduino board. Code must be entered in the best possible language structure which means utilizing substantial charge names and a legitimate syntax for every code line. The compiler will catch and banner language structure slips before download. Once in a while the blunder message can be enigmatic and you need to do a touch of chasing in light of the fact that the real slip happened before what was hailed.
In spite of the fact that your project may go neatly through the sentence structure checker, it still may not do what you needed it to. Here is the place you need to sharpen your aptitudes at code troubleshooting. The Arduino did what you instructed it to do instead of what you needed it to do. The most ideal approach to get these blunders is to peruse the code line by line and be the PC. Having someone else experience your code additionally makes a difference. Gifted investigating takes hone.
Format of #Program and #Syntax
Projects are entered line by line. Code is case delicate which signifies “myvariable” is not the same as “MyVariable”. Statements are ended with a semi-colon. A fantastic oversight is to overlook the semi-colon so if your project does not arrange, look at the blunder content and check whether you neglected to enter a colon.
Comments are any content that takes after “//” on a line. For multi-line piece slashes, start with “/*” and end with “*/“
Constants are fixed numbers and can be entered as ordinary decimal numbers (integer only) or in hexadecimal (base 16) or in binary (base 2)
Labels are utilized to reference areas in your project. They can be any blend of letters, numbers and underscore (_), yet the first character must be a letter. At the point when used to stamp an area, take after the name with a colon. At the point when alluding to a location mark in a direction line, don’t utilize the colon.
Here is a example:
Variables are assigned by announcing them in the code. Each variable must be announced. On the off chance that a variable is announced outside the supports of a capacity, it can be seen all over the place in the system. In the event that it is pronounced inside the supports of a capacity, the variable must be seen inside of that function.
Symbols are utilized to rethink how something is named and can be helpful for making the code more clear. Symbols are characterized with the “#define” charge and lines characterizing to go toward the start of your project. Here is a case without the situation where a LED (Light Emitting Diode) is joined with pin 3.
digitalWrite(3,HIGH);// turn LED on
digitalWrite(3,LOW);// turn LED off
Note: How the utilization of symbols lessens the requirement for remarks. Characters are to a great degree helpful to comments for gadgets associated with pins in LED on the off chance that you need to change the pin that, you just need to change the single character definition as opposed to experiencing the entire system searching for references to that pin out.
We hope explained well. For any suggestions or doubts please comment below. Thank you.