Articles on Trending Technologies

Technical articles with clear explanations and examples

Get ASCII table in Arduino

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 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 and binary representations. In this example, we will print out all these representations for printable ASCII characters. Remember that the first printable ASCII character starts from number 33, and the printable characters go on up to number 126. Since we will print out the ASCII table on the Serial Monitor, ...

Read More

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

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 1K+ 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 function also accepts an optional from argument, in case you want the backward search to begin from a specific index. The syntax in that case is −SyntaxmyString.lastIndexOf(substr, from)Just like indexOf(), this function either returns the last index of the substring within the string, or it returns -1 if no match ...

Read More

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

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 1K+ 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 from, in which case, the syntax is −SyntaxmyString.indexOf(substr, from)where from is the index from where the search should start. This function returns the index of the first occurrence of the substring within the string, or -1, if no match is found.Examplevoid setup() {    // put your setup code here, ...

Read More

How to Trim a String in Arduino?

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 6K+ 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() {    // put your setup code here, to run once:    Serial.begin(9600);    Serial.println();    String string1 = " Hello World! ";    Serial.println(string1);    string1.trim();    Serial.println(string1); } void loop() {    // put your main code here, to run repeatedly: }OutputThe Serial Monitor output is ...

Read More

Semaphore and Mutex in FreeRTOS using Arduino

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 2K+ 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 semaphore is a synchronization mechanism between tasks. More specifically, it is a signalling mechanism. A task in the waiting state may receive a semaphore which tells it to do some work. Once the task has done that work, it will give the semaphore back. In practice, this is maintained by ...

Read More

Change the default location for saving sketches in Arduino IDE

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 1K+ 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 to change the default location, go to File → Preferences.In the dialog box that opens up, the first input field is the Sketchbook location. Click on the ‘Browse’ button next to it and choose your desired path.After changing the path, click OK. Now, if you try to save a new ...

Read More

Suspend/Resume tasks in FreeRTOS using Arduino

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 1K+ 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(). The syntax is −Syntaxvoid vTaskResume( TaskHandle_t xTaskToResume );This again takes the handle of the task to be resumed, and returns nothing.In order to see an example, we will walk-through the code given in −https://exploreembedded.com/wiki/Task_Suspend_and_ResumeAs you can see, four Task handles are declared initially, and the tasks are created in the ...

Read More

How to increase the font size of text in Arduino IDE?

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 1K+ Views

The default font size of Arduino IDE can be a bit too small for some developers. In order to increase the font size, go to File → Preferences.In the dialog box that opens up, change the value of Editor Font size. The default value is 12. You can set it to a value you are comfortable with.Click OK and the changes will reflect on your IDE immediately.

Read More

How to show line numbers in Arduino IDE?

Yash Sanghvi
Yash Sanghvi
Updated on 29-May-2021 3K+ Views

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 dialog that opens, tick the box that says ‘Display Line Numbers’.The line numbers will now appear on the Sketch.Alternatively, the line number of your cursor can always be obtained from the bottom-left corner of the screen. This is one of the not-so-well-known features of Arduino IDE.

Read More

Transistor Amplifier – Working Principle and Applications

Manish Kumar Saini
Manish Kumar Saini
Updated on 26-May-2021 10K+ Views

Transistor as an AmplifierA transistor can increase the strength of a weak signal and hence it can be used as an amplifier in a circuit. The weak signal is applied between the emitter – base junction and output is taken across the load connected in the collector circuit.In order to achieve desired amplification, emitter – base junction must remain forward biased. For this, a DC voltage VBB is applied in the input circuit in addition to signal. This DC voltage is known as Bias Voltage and its magnitude is such that it always makes the emitter – base junction forward ...

Read More
Showing 49551–49560 of 61,299 articles
Advertisements