Arduino Variable Types: Quick Start for Beginners

Arduino variable types

The concept of an Arduino variable is one of the first things beginners need to understand when programming microcontrollers. Variables store data that your Arduino sketch can use and modify. To declare a variable in Arduino, you must specify its type and name, like int ledPin = 13;. This tells the compiler what kind of data the variable will hold. Choosing the correct Arduino type of variable is important because it affects memory usage and how the data behaves. This guide explains what variables are, how to declare them, and which Arduino variable types are available. (more…)

Arduino: Change Device’s VID/PID/Name

Vendor IDs (VID) and product IDs (PID) are 16-bit numbers used to identify USB devices.

By these numbers a computer identifies what USB device is plugged in and what drivers to use with it.

If you are developing for example some Arduino-based USB HID keyboard, you may want to change the device’s VID/PID and the name, so the computer or any other host identifies and displays it as a standard keyboard.

In this note i will show how to change the VID/PID and the name of the Arduino-based device on the example of the Arduino Pro Micro. (more…)

Arduino: /dev/ttyACM0 – Permission Denied [SOLVED]

If you use an Arduino IDE on Linux (e.g. Ubuntu, Linux Mint, etc.), you may get the following errors while trying to upload a sketch to the Arduino broad:

Caused by: processing.app.SerialException: Error touching serial port ‘/dev/ttyACM0’.
– and –
Caused by: jssc.SerialPortException: Port name – /dev/ttyACM0; Method name – openPort(); Exception type – Permission denied.

In this note i am showing how to permanently fix the “Permission denied” error on the serial port /dev/ttyACM0 while uploading the Arduino sketch. (more…)

Arduino Pro Micro: Reset & Restore Bootloader

If you’ve accidentally uploaded some code to the Arduino Pro Micro board as “Arduino Micro”, “Arduino Leonardo” or any other board, there is a big chance to brick your board by crashing its bootloader so it won’t be recognized by the PC at all anymore.

To revive the “bricked” Arduino Pro Micro you can try to reset the board and restore the bootloader by uploading any sketch with the board and processor options correctly set. (more…)

Arduino Pro Micro: Board Selection

If you try to upload your code to the Arduino Pro Micro board as “Arduino Micro”, “Arduino Leonardo” or any other board because you can’t find any called “Arduino Pro Micro”, there is a big chance to brick your board by crashing its bootloader so it won’t be recognized by the PC at all anymore.

By default, “Arduino Pro Micro” is not listed in the selection of boards in the Arduino IDE as it is the Arduino-compatible board developed by SparkFun.

In this note i will show how to add the SparkFun boards, including the “Arduino Pro Micro”, to the board selection menu in the Arduino IDE. (more…)

Install Arduino IDE on Ubuntu Linux

Even though an Arduino IDE can be easily installed on Ubuntu-like Linux system using the simple apt install arduino command, the version you will can get this way will be quite old – without the latest features and complicity in getting help on the Internet.

In this note i will show the recommended way of how to install the latest version of the Arduino IDE on Ubuntu, though these commands should work for the other Linux systems as well. (more…)

Arduino: Random Numbers & Delay – RandomSeed

A randomSeed(analogRead(0)) in Arduino initializes the pseudo-random number generator that reads the random analog noise from an unconnected analog pin 0 and floats to relatively random values between 0 and 1023.

This shuffles the random() number generator each time you start the Arduino sketch.

In this note i will show the examples of how to generate random numbers and create random delays in Arduino using the randomSeed() and random() functions. (more…)

Arduino: Key Press Simulation (Without Button)

A USB Keyboard function in Arduino can be used to send keystrokes to an attached computer.

Unfortunately this capability is limited to Arduino boards with the ATmega32u4 microchip i.e. Arduino Leonardo, Arduino Micro and Arduino-compatible Pro Micro (though the last one is really cheap).

Below you will find some code snippets with the examples of how to simulate keystrokes, including a multiple key pressing, using the Arduino boards.

To make it more simple, the keystrokes in the examples below will be called in a loop, so there is no need to install any additional hardware buttons. (more…)