Arduino from zero
Hello! Welcome
Together we are going to learn Arduino from scratch
What is Arduino?
It is a hardware and software platform for creating electronic projects.
With it, you can build:
- From small projects (like controlling lights, or a weather station)
- To big projects (like vehicles or robots!)
Choosing an Arduino
Arduinos are physical boards that you can program to control devices (like lights, motors, and sensors).
There are many models available, but the most common one is the Arduino UNO.
It is the most common and easy-to-use model.
How to use Arduino?
To use Arduino
- Connect the Arduino board to a computer
- Write a program
- Upload it to the board
That’s it! Arduino will execute that program when it starts (without needing the computer).
You’re doing great!
Now let’s talk about hardware
Inputs on Arduino
Arduino’s inputs allow us to take measurements from the world.
We can connect sensors that detect things (like light, temperature, or distance)
- Digital (measure 0 or 5V)
- Analog (measure in steps of 0.005V)
Outputs on Arduino
On the other hand, outputs allow us to perform actions in the real world.
- Digital (ON / OFF)
- Analog (called PWM)
With them, we can turn on a light, move a motor, or make a speaker sound.
The Serial Port
The serial port is a way of communication where Arduino can send and receive data from another device.
We will frequently use it to communicate Arduino with the computer (for example, to display messages)
The I2C and SPI Buses
But there are other ways of communication in Arduino, like the I2C and SPI protocols.
These are very common for connecting devices.
For example, sensors, displays, or even with other microprocessors.
Powering Arduino
Your Arduino can run the program without needing a computer.
For this, you’ll have to power it (that is, give it current).
For example, you can:
- Use a USB cable
- Use batteries
You’re almost there!
We just need to see how to program your Arduino.
Install the Software
To program Arduino, you’ll need to download the IDE. This is the program you’ll use to program your Arduino.
It’s free, and you can download it from the official Arduino website.
Programming
Don’t worry if you’ve never programmed before. The Arduino language is very easy to learn.
It is based on C++, but with some help to make it easy to use.
- We usually call this “language” wiring.
- And the programs we write, Sketches.
Your First Program
Your first program will be to turn a LED light on and off (we call it ‘blink’).
It’s a kind of test to start and make sure everything works fine.
Basic Structure
An Arduino program has a setup
function and a loop
function.
setup() {
// runs once when Arduino starts
}
loop() {
// runs continuously while it is on
}
Libraries
Generally, you’ll need libraries. These are collections of functions published by manufacturers like Adafruit or Sparkfun, or individual people.
You can add them from the library manager of the Arduino IDE.
Then you can add it to your code with:
#include library_name
Well done!
You now have the basics so you can keep learning on your own.