Yash Sanghvi has Published 220 Answers

How to show line numbers in Arduino IDE?

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 12:52:36

Line numbers are often necessary when working with large files consisting of several functions. Most developers prefer to have the line numbers shown in their code editing software.By default, line numbers are hidden in the Arduino IDE. In order to display the line numbers, go to File → Preferences.In the ... Read More

Arrays in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 02-Apr-2021 09:02:33

Declaring an ArrayIn order to declare an array, you follow the syntax give below −Syntaxtype array_name[array_size];Exampleschar buf[500]; int new_array[200];Accessing elements of the arrayThe array element numbering starts from 0. The element can be accessed by specifying the index of the element in square brackets against the name of the array. ... Read More

RTOS Introduction with Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:46:29

RTOS stands for Real Time Operating System. It is used to run multiple tasks concurrently, schedule them as required, and enable them to share resources. Now, while getting into the details of RTOS is out of the scope of this article, we will walk through an example that will give ... Read More

Timer Interrupts in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:41:38

As discussed in another article, Timers are basically counters. When they reach the end of the count, they overflow. We can use this event to generate an interrupt. Now, the traditional way of generating the interrupts in Arduino involve changing a lot of registers. Luckily, we have libraries for making ... Read More

Timers in Arduino Uno

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:39:15

As discussed earlier, Arduino Uno has 3 timers: Timer0, Timer1 and Timer2. Timer0 and Timer2 are 8-bit counters (they count from 0 to 255), while Timer1 is a 16-bit counter (it counts from 0 to 65535). Internally, Timer0 is used for the millis() function, and therefore, it is recommended not ... Read More

Timers in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:38:49

Every microcontroller has one or more timers that help the users perform tasks at precise intervals. Arduino Uno, for example, has 3 timers: Timer0, Timer1 and Timer2. Other boards may have the same or different number of timers, which you can find from the datasheet of that board/ microcontroller. What are ... Read More

PWM in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:37:46

What is PWM?PWM refers to Pulse Width Modulation. In very simple terms, we can output a square wave from certain pins of the Arduino board, and we can control the fraction of time for which the wave will be at the HIGH state (known as the duty cycle).Why is PWM ... Read More

Difference between float and double in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:34:40

FloatFloating point numbers are stored using 4 bytes (32 bits).Their max value can be 3.4028235E+38 and their min value can be -3.4028235E+38.They have a precision of about 6-7 decimal places.DoubleWhile on several platforms, double has more precision than float. However, on most Arduino boards (Uno and many other ATmega boards), ... Read More

Difference between signed and unsigned integer in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:33:44

When you define an integer, it is signed by default. In other words, it can accept both positive and negative values. Unsigned integers, as the name suggests, accept only positive values. Therefore, they have a higher range.If you are using a board that uses two bytes (16 bits) to represent ... Read More

Calculate time of operation in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 24-Mar-2021 05:32:20

Often, you need to measure the time your microcontroller takes to perform a particular task. You can use the millis() function of Arduino to measure the time. This function returns the number of milliseconds passed since your board started running the current program. Therefore, to calculate the time taken by ... Read More

Advertisements