The Coding Syntax
We now need to take a look at some of the syntax that we are able to create when it comes to coding in the Arduino board.
There are a few parts of this syntax that we are able to work with and need to spend our time on.
Knowing these parts are going to ensure that we get the best results in the process.
Some of the syntax parts that we need to focus our attention on here will include:
  1. The semicolon:
This is going to be used as a type of period in the English language because it helps us to end the statement we are using in coding.
We have to make sure that the statement we are closing up with the semicolon is one that we consider complete, or we will find that the code will not work out in the right manner along the way.
  1. Curly braces:
These are going to be useful and have a lot of complex functions in our codes, but the main thing that we need to know at this point is that when they are inserted in the beginning, you do need to follow all of that up with a pair of curly braces to get it closed up.
This is going to make sure that the information in the braces is balanced and will not allow someone else to mess around with them.
  1. // or a single line comment:
If you would like to set a reminder for yourself or to tell another person about how the code is going to function, then we need to use this code to begin the comment.
Make sure that with this one that we are only taking up one line at a time.
This is not going to transfer over to the processor of your controller, but will be live in the code, and can be a good reference to you, as well as to anyone else who is manually going through the code:
  1. /* */ or a multi-line comment:
This type of comment is going to open up and can span past more than one line.
It is going to contain just a single line comment but is not going to contain another multi-line comment as well.
Be sure to close with the other part of the process, or the whole of the code that comes after this is going to be seen as a comment and it won’t be implemented for you.
  1. #define:
This is going to be the part that will ensure that we are able to define a certain variable as a value that is more constant.
It is going to provide us a name to value as a shorthand method for that value.
These are not going to end up with any memory space used on the chip, so it is great to use them as a way to conserve the space that we have on the compiler.
  1. #include:
This is going to be the one that we are able to use when we would like to add in a few more libraries to any sketch that we are trying to use, such as including other words and other coding languages to the sketch, ones that re not automatically found there.
For example, if you are going through this, you could decide to include the C or the AVR libraries and some other tools to make the coding easier, and this is going to help get it done.
  1. One main thing that we need to remember with this one is that you do not want to add in a semicolon to the end of this statement, and the same rule is going to apply when you work with the #define that we talked about before.
If we do add this semicolon at this point to close things up, then you will end up with an error here, and the code is not going to work well.