The Arduino Leonardo is a versatile microcontroller board based on the ATmega32u4. It is a member of the Arduino family and is notable for its built-in USB communication, eliminating the need for a secondary processor. This feature allows the Leonardo to appear as a mouse or keyboard to a connected computer, in addition to a virtual (CDC) serial / COM port. It is widely used in hobbyist and educational environments for creating interactive projects such as automation systems, robotics, and custom gaming controllers.
Pin Number | Function | Description |
---|---|---|
1-14 | Digital I/O | Digital pins, can be used for input/output |
15-20 | Analog Inputs | Can also function as digital I/O |
3, 5, 6, 9, 10, 11, 13 | PWM Output | Pins capable of 8-bit PWM output |
A0-A5 | Analog Inputs | Analog input pins, can also function as digital I/O |
A6-A11 | Analog Inputs | Additional analog inputs on the ICSP header |
RX/TX | Serial Comm. | Used for serial communication |
RST | Reset | Used to reset the microcontroller |
GND | Ground | Ground pins |
5V | Power | Regulated power supply for the microcontroller and components |
3.3V | Power | 3.3V supply generated by the onboard regulator |
VIN | Voltage Input | Unregulated input voltage to the Arduino board |
Powering the Board:
Connecting I/O Devices:
Programming the Board:
Board not recognized by the computer:
Sketch not uploading:
Unexpected behavior in circuits:
Here is a simple example of blinking an LED connected to pin 13 on the Arduino Leonardo:
// Define the LED pin
const int ledPin = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(ledPin, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
This code will blink the onboard LED on the Arduino Leonardo, which is a great way to test if your setup is working correctly. Remember to select "Arduino Leonardo" from the Tools > Board menu in the Arduino IDE before uploading the sketch.