KNOWLEDGE ARDUINO PROGRAMMING LANGUAGE

in steemit •  7 years ago 

arduino.png
Arduino is an open source electronic platform devoted to the use of hardware and software. To better understand arduino programming language we must understand what is meant by physical computing. Physical computing is to create software and hardware that are interactive that can receive stimuli from the environment and backlash. Arduino is said to be a platform of physical computing that interests open source.

In general the structure of writing arduino program as follows:

  1. Inclusion Library:
    include the libraries we will use in the program
    Example :
    1.png

2.Defining variables or hardware.
Namely define hardware or variables that will be used.

Example:
LiquidCrystal lcd (12, 11, 5, 4, 3, 2); // defines the character lcd pin
#define key 5 // defines pin 5 as button
#define sensor 4 // defines pin 4 as sensor
#define led 3 // defines pin 3 as led

3 Hardware Initialization

Initialize hardware is to set the hardware that we will use according to our needs, we can determine a pin whether to be output or input, setting the pin made serial, or will be used lcd dll. This initialization is in the void setup () function, this function is run only once when the program starts to run.

Example:
void setup () {
// all the code here will be read once by Arduino
}
void loop () {
// all the code here will be read repeatedly (continuously) by Arduino
}
All program codes that are in the void setup will be read once by Arduino. Usually the contents of the command code to determine the function on a pin

4.The main function
The main function is the function that runs continuously when the program is run. This function is in a void loop ().
Example:
void loop () {
digitalWrite (led, HIGH);
delay (1000);

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!