The only language you really need to know to code an Arduino is C++. Even with just the basics, you can do quite a lot. These are some things I think are a must to know:
- Variables
- If Statments
- Loops
- Importing Classes
- Calling Functions
Next you can download the Arduino IDE and install your system.
If this is the first time you run the Desktop IDE, you can see a tab (called sketch) filled with the two basic Arduino functions: the setup() and loop().
setup():
Use it to initialize variables, pin modes, start using libraries and etc. The setup()
function will only run once and after each power-up or reset of the Arduino board
int pin = 3;
void setup() {
pinMode(pin, INPUT);
}
void loop() {
// ...
}
loop():
After creating a setup()
function, which initialize and set up the initial values and loop()
function does precisely what its name suggests, and loops
consecutively, allowing your program to change and respond. Use it to
actively control the Arduino board.
void setup() {
// put your setup code here, to run once:
pinMode(13,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(13,HIGH);
// digitalWrite(13,LOW);
}
Then you can compile the program and upload to Arduino Board and Finally see the result.
Comments
Post a Comment