Articles on Trending Technologies

Technical articles with clear explanations and examples

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 5K+ 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 9K+ 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

Resistors in AC Circuits

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

Important TermsAC Circuit − A closed path followed by alternating current is called as an AC Circuit.Resistance − The measure of opposition offered by a material in the path of electric current is known as resistance of that material. The element possessing the resistance is known as Resistor.Peak Value of Voltage or Current − It is the maximum value attained by an alternating quantity. It is also called as Amplitude.Average Value − The arithmetical average of all values of an alternating quantity over one cycle is called as average value. For sinusoidal voltage or current, $$\mathrm{I_{avg}=\frac{2I_{m}}{\pi}=0.637I_{m}}$$$$\mathrm{V_{avg}=\frac{2V_{m}}{\pi}=0.637I_{m}}$$Root Mean Square (RMS) value ...

Read More

Physical Limitations of Operational Amplifiers

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

A practical operational amplifier exhibits some limitations that should be considered in the design of instrument.The Physical Limitations of Operational Amplifier −Voltage Supply LimitationsFinite Bandwidth LimitationsInput Offset Voltage LimitationsInput Bias Current LimitationsOutput Offset Voltage LimitsSlew Rate LimitationShort Circuit Output LimitsLimited Common Mode Rejection RatioVoltage Supply LimitationsAn operational amplifier is power by an external DC power supply (+VCC and -VCC), which are symmetric and of the order of ± 10 V to ± 20 V. The effect of voltage supply limits is that amplifiers are able to amplify the signals only within the range of their power supply voltage. It is ...

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