Arduino LEONARDO  What are they? + Features and Utility ▷ 2020

The special features that Arduino Leonardo has You can find them in the following paragraphs of this article. We will explain, in a simple way, what this is for free hardware board.

Further, you will be able to know the main benefits that Arduino Leonardo has and what are the components it uses. Being one of the most important, the distribution of its pins on the bus.

But this is not all you will find in the post, we will also present you the most interesting projects that you can create yourself with Arduino Leonardo. Read on and become a true electronics expert.

What is Arduino Leonardo and what is this free development board for?

Arduino Leonardo It is a board with an ATmega32u4 MCU, 32KB flash memory and a 2.5 KB static. It has a hardware USB port so serial-USB conversion is not necessary, this allows can work on a large number of projects and use peripherals (such as a keyboard or mouse) to improve user comfort.

Differs with Arduino UNO for having 20 digital pins, of which it can distribute 12 for analog inputs and 7 for pulse modulation, which can withstand a maximum input and output current of 40 mA. This plate offers great versatility thanks to the anatomy it offers Arduino.

What are the most interesting features of the Arduino Leonardo development boards?

What are the most interesting features of Arduino Leonardo development boards?

The main features that Arduino Leonardo has are:

  • In relation to other plates the Arduino Leonardo has more pins. This allows you to include more elements at the same time, so there is no need to add more circuits to complex projects.
  • Static SRAM memory has more capacity than Arduino UNO (the most used plate), since it is 2.5 KB which benefits in those projects where speed in processing is needed.
  • The dimensions are similar to those of other plates, so it can be included in any type of project. This also has the benefit that its cost is not high.
  • By having native ports, you can directly connect peripherals that help improve the handling and programming of the board.
  • On the official page of Arduino there are libraries that can easily access and use in project scheduling.

Anatomy of the Arduino Leonardo What components does it use?

The components used in an Arduino Leonardo board are:

  • Its dimensions totals are 68.6 × 53.3mm with an approximate weight of 20 grams.
  • He MCU it is a model microcontroller Atmel ATmega32u4 who works at 16 Mhz.
  • The flash memory, subtracting the 4 KB of the bootloader, it is 28 KB.
  • EEPROM is 1KBwhile the SRAM memory is 2.5 KB.
  • It has the pins A0 to A11 as analog inputs, while for PWM the pins 3, 5, 6, 9, 10, 11 and 13.
  • It has an I2C bus in which it locates the data line and the clock line in the pins 2 and 3, respectively.
  • Dispose of one 6-pin male connector used for communication ICSP, this is an important difference with respect to other boards, since the others have different pins for SPI communication.
  • The pins 3, 2, 0, 1, and 7 is used for external interrupt of type 0, while for interrupt 1 it has the pins 0, 1, 2, 3, and 4.
  • The port for the USB connection is of type A-micro B.

List of the most interesting projects that you can create yourself with Arduino Leonardo

In the steps that follow you will find the best projects that you can create yourself with an Arduino Leonardo board:

Keyboard extension

Keyboard extension

You will be able to use an Arduino Leonardo board in a project that allows you to add capacitive touch keys and then customize them. For this you will need, in addition to the plate Arduino Leonardo, necessary amount of capacitive touch sensors, a breadboard cables for connection. The first thing you will need to do is mount by inserting the cables into the connectors and then create the hotkeys.

For this you will have to enter:

#include <Keyboard.h>

const int delayValue = 100;

const char cmdKey = KEY_LEFT_GUI;

void setup(){

pinMode(2, INPUT);

pinMode(3, INPUT);

pinMode(4, INPUT);

pinMode(5, INPUT);

begin();

}

void loop(){

if (digitalRead(2)) {

press(cmdKey);

press('c');

delay(delayValue);

releaseAll();

while(digitalRead(2));

}

if (digitalRead(3)) {

press(cmdKey);

press('v');

delay(delayValue);

releaseAll();

while(digitalRead(3));

}

if (digitalRead(4)) {

press(cmdKey);

press('n');

delay(delayValue);

releaseAll();

while(digitalRead(4));

}

if (digitalRead(5)) {

press(cmdKey);

press('z');

delay(delayValue);

releaseAll();

while(digitalRead(5));

}

}

Then you must enter the following codes to finish programming:

#include <Keyboard.h>

configuración vacía () {

pinMode ( 2 , ENTRADA );

pinMode ( 3 , ENTRADA );

pinMode ( 4 , ENTRADA );

pinMode ( 5 , ENTRADA );

Teclado . comenzar ();

}

bucle vacío () {

checkPress ( 2 , 'd' );

checkPress ( 3 , 'f' );

checkPress ( 4 , 'g' );

checkPress ( 5 , 'h' );

}

void checkPress ( int  pin ,  char  key )  {

if ( digitalRead ( pin ))  {

Teclado . presione ( tecla );

}

else {

Teclado . liberación ( tecla );

}

}

Program your CNC machine

Program your CNC machine

You will need a badge Arduino Leonardo and buttons to convert to your machine CNC with a wooden pendant. This project will help you move the wheel and keep the rest of the team still when you work.. You can incorporate different switches, modify the size of the command and choose a steering wheel that suits your needs.

After assembling the pieces you will have to program the following codes in the Arduino IDE:

#include "ClickButton.h"

#include "Keyboard.h"

long int aux1_delay =  0 ;

botones int const =  20 ;

const int buttonPin0 =  0 ;

const int buttonPin1 =  0 ;

const int buttonPin2 =  1 ;

const int buttonPin3 =  2 ;

const int buttonPin4 =  3 ;

const int buttonPin5 =  4 ;

const int buttonPin6 =  5 ;

const int buttonPin7 =  6 ;

const int buttonPin8 =  7 ;

const int buttonPin9 =  8 ;

const int buttonPin10 =  9 ;

const int buttonPin11 =  10 ;

const int buttonPin12 =  11 ;

const int buttonPin13 = 12;

const int buttonPin14 = 13;

const int buttonPin15 = A0;

const int buttonPin16 = A1;

const int buttonPin17 = A2;

const int buttonPin18 = A3;

const int buttonPin19 = A4;

const int buttonPin20 = A5;

{

ClickButton (buttonPin0, LOW, CLICKBTN_PULLUP),

ClickButton (buttonPin1, LOW, CLICKBTN_PULLUP),
  • Keep going in the same way until buttonPin20, then close SDI with };

Then you will have to continue entering these codes:

void setup()

{

for (int i = 1; i <= buttons; i++)

{

button[i].debounceTime = 20;

button[i].multiclickTime = 250;

button[i].longClickTime = 1000;

}

}

void loop()

{

for (int i = 1; i <= buttons; i++)

{

button[i].Update();

}

if (button[1].clicks != 0)

{

switch (button[1].clicks)

{

case 1: // Single click

press_RESET();

break;

case 2: // Double click

press_ESC();

break;

case 3: // Triple click

break;

case -1: // Single Click and Hold

// TURN DRIVERS OFF

press_ESC();

goto_MACHINE_IO_MENU();

press_F2();

goto_MAIN_MENU();

break;

case -2: // Double Click and Hold

break;

case -3: // Triple Click and Hold

break;

}

}

if (button[2].clicks != 0)

{

switch (button[2].clicks)

{

case 1: // Single click

press_ESC();

goto_MAIN_MENU();

break;

case 2: // Double click

break;

case 3: // Triple click

break;

case -1: // Single Click and Hold

break;

case -2: // Double Click and Hold

break;

case -3: // Triple Click and Hold

break;

}

}

if (button[3].clicks != 0)

{

switch (button[3].clicks)

{

case 1: // Single click

break;

case 2: // Double click

break;

case 3: // Triple click

break;

case -1: // Single Click and Hold

press_ESC();

goto_MAIN_MENU();

shortcut_HOME_ALL();

break;

case -2: // Double Click and Hold

break;

case -3: // Triple Click and Hold

break;

}

}

if (button[4].clicks != 0)

{

switch (button[4].clicks)

{

case 1: // Single click

// TOGGLE MDI

shortcut_TOGGLE_MDI();

break;

case 2: // Double click

break;

case 3: // Triple click

break;

case -1: // Single Click and Hold

break;

case -2: // Double Click and Hold

break;

case -3: // Triple Click and Hold

break;

}

}

From here you can add for each button what actions you want to do. You can break, start the timer, wait, etc. For modifier keys you will have to use these definitions established by Arduino Leonardo. We are going to express the key first, then the hexadecimal value and finally its decimal value.

See below:

KEY_LEFT_CTRL 0x80 128

KEY_LEFT_SHIFT 0x81 129

KEY_LEFT_ALT 0x82 130

KEY_LEFT_GUI 0x83 131

KEY_RIGHT_CTRL 0x84 132

KEY_RIGHT_SHIFT 0x85 133

KEY_RIGHT_ALT 0x86 134

KEY_RIGHT_GUI 0x87 135

KEY_UP_ARROW 0xDA 218

KEY_DOWN_ARROW 0xD9 217

KEY_LEFT_ARROW 0xD8 216

KEY_RIGHT_ARROW 0xD7 215

KEY_BACKSPACE 0xB2 178

KEY_TAB 0xB3 179

KEY_RETURN 0xB0  176

KEY_ESC 0xB1  177

KEY_INSERT 0xD1  209

KEY_DELETE 0xD4  212

KEY_PAGE_UP 0xD3  211

KEY_PAGE_DOWN 0xD6  214

KEY_HOME 0xD2  210

KEY_END 0xD5  213

KEY_CAPS_LOCK 0xC1  193

KEY_F1 0xC2  194

KEY_F2 0xC3  195

KEY_F3 0xC4  196

KEY_F4 0xC5  197

KEY_F5 0xC6  198

KEY_F6 0xC7  199

KEY_F7 0xC8  200

KEY_F8 0xC9  201

KEY_F9 0xCA  202

KEY_F10 0xCB  203

KEY_F11 0xCC  204

KEY_F12 0xCD  205

An example of the programming of these keys is:

void press_RESET()

{

begin();

press(KEY_F1);

delay(100);

releaseAll();

}

void press_ESC()

{

begin();

press(KEY_ESC);

delay(100);

releaseAll();

}

void press_F2()

{

begin();

press(KEY_F2);

delay(100);

releaseAll();

}

void press_F3()

{

begin();

press(KEY_F3);

delay(100);

releaseAll();

}

Motion sensor

Motion sensor

With this project you will be able to create a radar that turns on an LED light when it detects movement in a nearby area. For this you will need a plate Arduino Leonardo, an ultrasonic sensor, a stepper motor, LED lights and cables to assemble. The next step will be assemble the components and write the following commands for led light and ultrasonic sensor.

These are:

{larga duración; pinMode (trigPin, SALIDA);

pinMode (echoPin, INPUT);

digitalWrite (trigPin, BAJO);

delayMicroseconds (2);

digitalWrite (trigPin, HIGH);

delayMicroseconds (20);

digitalWrite (trigPin, BAJO);

duración = pulseIn (echoPin, HIGH);

duración = duración / 59;

if ((duración <2) || (duración> 300)) devuelve falso;

duración del regreso; }

configuración vacía ()

{Serial.begin (9600);

digitalWrite (6, BAJO);

pinMode (5, SALIDA); }

bucle vacío ()

{Serial.print ("distancia:");

print ("");

print (ardublockUltrasonicSensorCodeAutoGeneratedReturnCM (6, 7));

print ("");

println ();

si ((((ardublockUltrasonicSensorCodeAutoGeneratedReturnCM (6, 7))

<(30.0)) && ((ardublockUltrasonicSensorCodeAutoGeneratedReturnCM (6, 7))> (0.0)))) {digitalWrite (5, HIGH); }

{

digitalWrite (5, BAJO); }}

Next, you must enter the codes for the operation of the engine:

void __StepMotor (int MotorStep, int MotorSpeed, int pinNumberA, int pinNumberB, int pinNumberC, int pinNumberD)

{

pinMode (pinNumberA, SALIDA);

pinMode (pinNumberB, SALIDA);

pinMode (pinNumberC, SALIDA);

pinMode (pinNumberD, SALIDA);

para (int i = 0; i

digitalWrite (pinNumberA, HIGH);

digitalWrite (pinNumberB, LOW);

digitalWrite (pinNumberC, LOW);

digitalWrite (pinNumberD, LOW);

retraso (MotorSpeed);

digitalWrite (pinNumberA, LOW);

digitalWrite (pinNumberB, HIGH);

retraso (MotorSpeed);

digitalWrite (pinNumberB, LOW);

digitalWrite (pinNumberC, HIGH);

retraso (MotorSpeed);

digitalWrite (pinNumberC, LOW);

digitalWrite (pinNumberD, HIGH);

retraso (MotorSpeed);

}

digitalWrite (pinNumberD, LOW); }

configuración vacía ()

{

}

bucle vacío ()

{__StepMotor (1024.0, 10.0, 8, 9, 10, 11);

retraso (1000,0);

__StepMotor (1024.0, 10.0, 11, 10, 9, 8);

}

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thank you! 😉

You may be interested:

Leave a Comment