Arduino Basics
- lukepat74
- 1 lut 2017
- 2 minut(y) czytania
As, the Arduino is popular worldwide and generally enjoyed, it is useful to know at least the basics.

First, You need to know enough about the main board.(picture) The 1 to 13 pins are digital-type. It means You can let electronical signals through them, but only with the minimum (0V - LOW) or maximum (5V - HIGH). You can control the power that comes through with the analog-type (A0-A5). Some of the digital pins have the same property too. They are: 3, 5, 6, 9, 10 and 11 on the PWM(digital) panel. In this tutorial we'll be using the digital panel, because it's easiest and the same efficient. But first, let's download the main code editor. Link to the download page: https://www.arduino.cc/en/main/software
Let's get to work!
The first sketch, which means program will make a built-in led diode blink.
CODE:
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN ,HIGH);
delay(1000);
digitalWrite(LED_BUILTIN,LOW);
delay(1000);
}
Also, this appears in one of the ready to use examples when You download the editor which You can open.
Exclaimation:
- Everything that appears between the two braces "{ to }" under ( after ) "void setup()" will be executed once and the ones under ( after ) "void loop()" - repeatedly until the power is plugged off.
- pinMode(<pin>, <type>); initializes a chosen pin on a chosen panel. You can choose whether it is INPUT, so that You can read e.x the power of electricity that comes through it, or OUTPUT, so that You can only send electronical signals of a chosen power.
- digitalWrite(<pin>, <power>); sends a signal to a chosen pin of a chosen power. However, digitalWrite(); can only send HIGH (0V) or LOW(5V), even if it's an analog pin or a digital pin like ~3, ~5, ~6, ~9 ~10 or ~11 (see higher why I've mentioned this).
If you want to send some other value, use analogWrite(<pin>,<power>);
- delay(<miliseconds ( 1/1000 of a second )>); simply makes the program wait the chosen amount of time.
Comments