Yash Sanghvi has Published 220 Articles

Get ASCII table in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:30:09

2K+ Views

In this article, we will walkthrough the example code in Arduino, which helps generate the ASCII table in the Serial Monitor output. For your reference, this is what the ASCII table looks like − http://www.asciitable.com/It contains the character, followed by its ASCII code in decimal, hexadecimal, and sometimes, even octal ... Read More

Switch case in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:29:47

9K+ Views

Switch case in Arduino is just like the switch case in C language. For those who are unaware of switch case, it is a more compact way of writing multiple if statements, when they concern the value of a variable.Syntaxswitch (var) {    case value1:       // statements ... Read More

Digital Read in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:29:22

5K+ Views

Just like analogRead() helps you to read analog voltages, digitalRead() helps you read digital levels.SyntaxdigitalRead(pin)When pin is the number of the pin whose digital level you wish to read. This function returns either HIGH or LOW.Please note that if the pin you are wishing to read is not connected to ... Read More

Get the last occurrence of a substring within a string in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:28:49

628 Views

Just like indexOf() helps identify the first occurrence of a substring within a string, the lastIndexOf() function helps identify the last occurrence. This is because lastIndexOf() performs backward search, while indexOf() performs forward search.syntaxmyString.lastIndexOf(substr)Where substr is the substring to search for in myString. It can be a character or a string.Just like indexOf(), this ... Read More

Get the first occurrence of a substring within a string in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:27:49

542 Views

The indexOf() function within Arduino scans a string from the beginning, and returns the first index of the specified substring within the string. The syntax is −SyntaxmyString.indexOf(substr)where substr is the substring to search for. It can be of type character or string.Optionally, you can provide a different starting point to begin the search ... Read More

How to Trim a String in Arduino?

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:11:42

4K+ Views

Sometimes, a string can contain leading or trailing whitespaces. Arduino has a trim() function that removes all these leading/trailing whitespaces from the string.SyntaxString1.trim()Where String1 is the string that you need to trim. Please note that this function doesn’t return anything. String1 itself is modified.ExampleThe following example illustrates this −void setup() ... Read More

Check if two strings are equal while ignoring case in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:11:04

666 Views

We know that String1.equals(String2) can be used to find out if String1 and String2 are equal in Arduino. However, this function is case sensitive. So, if there is a difference in the case of even a single character, this function will return false. A strategy that people use to perform ... Read More

Semaphore and Mutex in FreeRTOS using Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:09:18

1K+ Views

Semaphore and Mutex are tools/mechanisms to bring about synchronization between tasks in FreeRTOS. Often, two tasks need to share a resource, or one task needs to tell another that it is idle/waiting. Semaphores and Mutex help here. In this article, we will look at the concepts of semaphore and mutex.SemaphoreA ... Read More

Change the default location for saving sketches in Arduino IDE

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:08:43

807 Views

By default, on a Windows machine, Arduino saves all the sketches in C:\Users\\Documents\Arduino. Now, for whatever reason, you may want to change this default location. A common reason is that the C: has limited storage and you’d like to save sketches to a drive which has enough free space.In order ... Read More

Suspend/Resume tasks in FreeRTOS using Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:04:26

770 Views

If you wish to suspend a task in FreeRTOS, there is a function vTaskSuspend() that can be used. The syntax is −Syntaxvoid vTaskSuspend( TaskHandle_t xTaskToSuspend );As you can see, it takes the handle of the task to suspend as the argument and returns nothing. A suspended task can be resumed using vTaskResume(). ... Read More

Advertisements