Arduino is used for enabling users to create interactive electronic objects. In Previous articles we talk about : arduino boards and arduino software (IDE). In this article we will recognize What is arduino programming language?.
The arduino programming language, is the de-facto standard for embedded programming on on very large number of architectures and hardware platforms.
To write code in the Arduino we uses the C++ programming language, which is a widely used and well-known programming language, the code is written in C++ with an addition of special methods and functions. Arduino programming language can be divided in three main parts “functions”, “values”, and “structure”.
Functions:
example : “digitalRead()”, “digitalWrite()”, “pinMode()”, “analogRead()”, “analogWrite()”, “constrain()”, “delay()”, “random()”…
Values (variables and constants):
example : “char()”, “float()”, “int()”, “long()”, “INPUT”, “OUTPUT”, “HIGH”, “LOW”, “String()”, “void” …
Structure:
example : “loop()”, “setup()”, “do…while”, “if”, “else”, “for”, “#define (define)”, “#include (include)”, “! (logical not)”, “++ (increment)”, …
Example of the Arduino Programming Language :
control LED lights with Arduino
int LED1 = 10;
int LED2 = 11;
// by www.andprof.com
void setup() {
// put your setup code here, to run once:
pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED1,HIGH);
delay(1000);
digitalWrite(LED2,HIGH);
delay(1000);
digitalWrite(LED1,LOW);
delay(1000);
digitalWrite(LED2,LOW);
delay(1000);
}