You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learn/01.starting-guide/00.getting-started-arduino/getting-started-arduino.md
+38-24Lines changed: 38 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -55,15 +55,16 @@ While all Arduino boards differ from each other, there are several key component
55
55
56
56
![Key components of an Arduino board.]()
57
57
58
-
-**1.** Microcontroller - this is the brain of the Arduino, and is the component that we load programs into. Think of it as a very tiny computer, designed to execute a specific number of things.
58
+
-**1.** Microcontroller - this is the brain of an Arduino, and is the component that we load programs into. Think of it as a tiny computer, designed to execute only a specific number of things.
59
59
-**2.** USB port - used to connect a USB cable from your computer.
60
-
-**3.** USB to serial chip - the USB to Serial is an important component, as it helps translate data that comes from e.g. a computer to the microcontroller. This is what makes it possible to program it from your computer.
60
+
-**3.** USB to Serial chip - the USB to Serial is an important component, as it helps translate data that comes from e.g. a computer to the microcontroller. This is what makes it possible to program it from your computer.
61
61
-**4.** Digital pins - pins that uses digital logic (0,1 or LOW/HIGH). Commonly used for switches and to turn on an LED.
62
62
-**5.** Analog pins - pins that can read analog values in a 10 bit resolution (0-1023).
63
63
-**6.** 5V / 3.3V pins- these pins are used to power external components.
64
64
-**7.** GND - also known as `ground`, `negative` or simply `-`, is used to complete a circuit, where the electrical level is at 0 volt.
65
+
-**8.** VIN - stands for Voltage In, where you can connect external power supplies.
65
66
66
-
Generally speaking, all Arduino boards have the above components, but there are of course many more than meets the eye.
67
+
Depending on the Arduino board, you will find many more components. Listed above are generally found on any Arduino board.
67
68
68
69
### Basic Operation
69
70
@@ -76,21 +77,24 @@ The program that is loaded to the microcontroller will start execution as soon a
76
77
- Check whether a condition is met.
77
78
- All of the above.
78
79
79
-
The speed of a program is incredibly fast, unless we tell it to slow down. It depends on the size of the program and how long it takes for the microcontroller to execute it, but it is generally in **microseconds(or one millionth of a second)**.
80
+
The speed of a program is incredibly fast, unless we tell it to slow down. It depends on the size of the program and how long it takes for the microcontroller to execute it, but it is generally in **microseconds (one millionth of a second)**.
80
81
81
-
![The basic operation of an Arduino]()
82
+
![The basic operation of an Arduino.]()
82
83
84
+
### Circuit Basics
83
85
86
+
Circuits consist of at least one active electronic component, and consists of conductive material, such as wires, so that current can pass through. When working with an Arduino, you will in most cases build a circuit for your project.
84
87
85
-
### Circuit Basics
88
+
A simple example of a circuit, is an **LED circuit**. A wire is connected from a pin on the Arduino, to an LED via a resistor (to protect the board), and to ground (GND). When the pin is set to a **HIGH state**, the LED will turn on, as electric current is flowing through the circuit. When the pin is set to a **LOW state**, the LED will turn off, as electric current is not flowing through the circuit.
86
89
90
+
![An LED circuit with an Arduino.]()
87
91
92
+
Circuits are typically drawn as **schematics**, which are the blueprints for your circuit. In the schematic below, you will see the same circuit as the one above, but drawn differently.
88
93
94
+
![Schematics of a circuit.]()
89
95
90
96
### Electronic Signals
91
97
92
-
![Electronic signals.]()
93
-
94
98
All communication between any electronic components are done through **electronic signals.** There are two main types of electronic signals: **analog & digital**.
95
99
96
100
### Analog Signal
@@ -101,6 +105,10 @@ An analog signal is generally bound to a range. In an Arduino, that range is typ
101
105
102
106
If we for example use a potentiometer (an analog component used to change the resistance of a circuit), we can adjust this range (0-5V). In the program, this is represented in a range of 0-1023, which is a 10-bit resolution.
103
107
108
+
If we write an analog signal using Pulse-Width Modulation (PWM), we can use a range between 0-255, as we are using an 8-bit resolution.
109
+
110
+
***Read more about [Analog Inputs](/learn/microcontrollers/analog-input) and [Analog Outputs (PWM)](/learn/microcontrollers/analog-output).***
111
+
104
112
### Digital Signal
105
113
106
114
![Basics of a digital signal.]()
@@ -133,8 +141,6 @@ When working with Arduino, it is important to understand **sensors** and **actua
133
141
134
142
#### What Is a Sensor?
135
143
136
-
![The basics of a sensor.]()
137
-
138
144
A sensor, in simple terms, is used to *sense* its environment, meaning it records a physical parameter, for example temperature, and converts it into a signal.
139
145
140
146
Sensors can also take the form of just a simple button: when a state changes (we press the button), and electronic signal is switched from low to high (0 to 1).
@@ -146,6 +152,7 @@ Digital sensors are a bit more advanced, depending on the type. They rely on [Se
146
152
#### What Is an Actuator?
147
153
148
154
An actuator, in simple terms, is used to *actuate* or *change a physical state*. Some examples are:
155
+
149
156
- A light (such as an LED).
150
157
- A motor.
151
158
- A switch.
@@ -171,20 +178,16 @@ else{
171
178
172
179
### Serial Communication Protocols
173
180
174
-
![Serial communication protocols.]()
175
-
176
-
There are several serial communication protocols that uses the aforementioned digital signals to send data. The most common are **UART, SPI & I²C**. The UART protocol is used to send data between a computer and Arduino board, such as uploading a new program, or reading data directly from an Arduino.
181
+
There are several serial communication protocols that uses the aforementioned digital signals to send data. The most common are **UART, SPI & I²C**. The UART protocol is among other things, used to send data between a computer and Arduino board, such as uploading a new program, or reading data directly from an Arduino.
177
182
178
183
The SPI and I²C protocols are used for communication between both internal and external components. The communication is handled by something called a **serial bus**, which is attached to a specific pin on the Arduino.
179
184
180
-
Using the I²C protocol, we can connect several sensors on the same pin, and retrieve the data accurately. A device an address that we need to specify, where we can request this device to send back data.
185
+
Using the I²C protocol, we can connect several sensors on the same pin, and retrieve the data accurately. Each device has an address that we need to specify in the program, which we use when making data requests.
181
186
182
187
***Find out more in the [Arduino SPI Guide](/learn/communication/spi) and [Arduino I2C Guide](/learn/communication/wire).***
183
188
184
189
### Memory
185
190
186
-
![Memory types on an Arduino.]()
187
-
188
191
The "standard" Arduino typically has two memories: SRAM and Flash memory.
189
192
190
193
The SRAM (Static Random-Access Memory) is used to for example store the value of a variable (such as the state of a boolean). When powered off, this memory resets.
@@ -308,15 +311,15 @@ To use a library, you need to include it at the top of your code, as the example
308
311
#include <Library.h>
309
312
```
310
313
311
-
***You can browse through all official and contributed libraries in the [Arduino Libraries page]().***
314
+
***You can browse through all official and contributed libraries in the [Arduino Libraries page](https://www.arduino.cc/reference/en/libraries/).***
312
315
313
316
### Core Specific API
314
317
315
318
Every Arduino board requires a "core", or "package", that needs to be installed in order to program it. All packages contain the standard Arduino API, but also a specific API that can only be used with specific boards.
316
319
317
320
For example, the classic [ArduinoCore-avr](https://github.com/arduino/ArduinoCore-avr) package, automatically includes the [EEPROM](/learn/built-in-libraries/eeprom), and [SoftwareSerial](/learn/built-in-libraries/software-serial) libraries, and can be used freely without any additional installation. In this package you will find the classic Arduino UNO, Nano, Mega2560 and more.
318
321
319
-
Another example is the [ArduinoCore-mbed]() package, which includes over 40 libraries, designed for specific board features, such as:
322
+
Another example is the [ArduinoCore-mbed](https://github.com/arduino/ArduinoCore-mbed) package, which includes over 40 libraries, designed for specific board features, such as:
320
323
321
324
-**PDM** - used for sampling Audio from microphones onboard the Nano BLE Sense and Nano RP2040 Connect boards.
322
325
-**Ethernet** - for using the Ethernet functionalities of the Portenta Vision Shield.
@@ -326,7 +329,7 @@ These features are documented in the **documentation landing page** of each prod
326
329
327
330
## Arduino Software Tools
328
331
329
-
***The Arduino IDEs are available for download for free in the [Software downloads page]().***
332
+
***The Arduino IDEs are available for download for free in the [Software downloads page](https://www.arduino.cc/en/software).***
330
333
331
334
Now that we have a bit of background on Arduino hardware, let us move on to another fundamental: the Arduino Software tools.
332
335
@@ -401,14 +404,14 @@ A proper use of the CLI can speed up your development time by far, as any operat
401
404
402
405
In this section, you will find a list of some of the most common elements in the standard Arduino API. This will help you get familiar with some key building blocks.
403
406
404
-
To explore the whole Arduino API, please refer to the [Arduino Language Reference](), which is an in-depth wiki maintained by Arduino and its community.
407
+
To explore the whole Arduino API, please refer to the [Arduino Language Reference](), an in-depth wiki maintained by Arduino and its community.
405
408
406
409
407
410
### General
408
411
409
412
#### `setup()`
410
413
411
-
The `setup()` function is where you can make program configurations.
414
+
The `setup()` function is where you make program configurations.
412
415
413
416
```arduino
414
417
void setup() {
@@ -426,7 +429,7 @@ void loop() {
426
429
}
427
430
```
428
431
429
-
#### `delay(time)`
432
+
#### `delay()`
430
433
431
434
The `delay()` function pauses the program for a set number of milliseconds.
432
435
@@ -489,6 +492,8 @@ While the `millis()` function is a more advanced concept than the `delay()` func
489
492
490
493
#### Functions
491
494
495
+
***Learn more about [functions](/learn/programming/functions).***
496
+
492
497
You can create custom functions that either just executes code and returns to the program, or that returns a result.
493
498
494
499
Example of a `void` function that does not return:
@@ -543,6 +548,8 @@ void loop(){
543
548
544
549
#### Data Types
545
550
551
+
***See all data types in the [Language Reference](https://www.arduino.cc/reference/en#data-types).***
552
+
546
553
There are several data types available for use, and below are some of the most common:
547
554
548
555
```
@@ -581,10 +588,10 @@ For simple switches and true/false, we use booleans:
581
588
bool exampleSwitch = true/false;
582
589
```
583
590
584
-
***You can read more about this in the [variables & data types](https://www.arduino.cc/reference/en/#variables) in the Arduino Language Reference.***
585
-
586
591
### Serial Communication
587
592
593
+
***Read more about the [Serial class](https://www.arduino.cc/reference/en/language/functions/communication/serial/).***
594
+
588
595
Serial communication is **essential** to Arduino programming, as it is the easiest way to know what goes on on your board.
589
596
590
597
For this, we can use the `Serial` class.
@@ -794,3 +801,10 @@ x *= y; //x is now 10 (multiply and assign)
794
801
```
795
802
796
803
804
+
## Conclusion
805
+
806
+
In this guide, we have touched upon some of the fundamentals of Arduino: hardware, software tools, what is the Arduino API, and a quick intro to it. This guide serves mainly as an introduction to Arduino, and understanding the fundamental concepts.
807
+
808
+
To learn more, you can explore the [Arduino Documentation](/) and the [Arduino Language Reference](https://www.arduino.cc/reference/en/), where you will discover thousands of detailed tutorials, examples, API entries and other resources.
809
+
810
+
To purchase an Arduino board, visit the [Arduino Store](https://store.arduino.cc/).
0 commit comments