Yash Sanghvi has Published 220 Answers

Append to an existing file stored in SD Card connected to Arduino

Yash Sanghvi

Yash Sanghvi

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

In this tutorial, we will, as the title suggests, see how to append to a file in and SD Card connected to Arduino. Actually, it is quite simple. If you have gone through any previous articles on SD Card, then you only need to know thatmyFile = SD.open("example.txt", FILE_WRITE);opens example.txt ... Read More

Connect SD Card with Arduino and get Card Info

Yash Sanghvi

Yash Sanghvi

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

In this tutorial, we will connect our Arduino Uno to an SD Card and extract the card info.Circuit DiagramThe circuit diagram is shown below −As you can see, you need to make the following connections −SD Card HolderArduino UnoVcc5VGNDGNDMISO12MOSI11SCK13CS10Only for the Vcc, make sure that your SD Card Holder takes ... Read More

Wait for user input to start a sketch in Arduino

Yash Sanghvi

Yash Sanghvi

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

A problem faced by several people using Arduino, or any microcontroller board for that matter, is that you may forget to start the Serial Monitor before programming the board, and miss some print statements by the time you open the Serial Monitor.One way to overcome this is to start the ... Read More

Reserve memory in Arduino for string manipulation

Yash Sanghvi

Yash Sanghvi

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

It may happen that a string may change length dynamically during the execution of a program.If you want to ensure that there is always enough memory available for your string, you can reserve some memory using the reserve() function.SyntaxString1.reserve(n_bytes);Where String1 is the string for which you are reserving memory, and n_bytes (unsigned ... Read More

Compare Strings in Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:32:02

Arduino has an inbuilt compareTo() function that helps compare which string comes before another. Very crudely, you can think of it as this: if you are given two strings, which one will come first in a dictionary.SyntaxString1.compareTo(String2)Where String1 and String2 are the two strings to be compared. This function returns an ... Read More

Read values sent by Serial Monitor to Arduino

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:31:35

The Serial Monitor of Arduino has a text box at the top, through which, users can send in text to the Arduino board.The text can be read by Serial.read(). Also, the Serial.available() function can be used to check if there is any data to read. It returns the number of ... Read More

How to Remove Characters from a String in Arduino?

Yash Sanghvi

Yash Sanghvi

Updated on 29-May-2021 13:31:15

The remove function in Arduino helps you remove one or more characters from within a string.SyntaxmyString.remove(index, count)Here, index refers to the index from where removal has to start. Note that indexing in Arduino starts with 0. Thus, within string "Hello", 'H' is at index 0, 'e' is at index 1, and ... Read More

Set characters at a specific position within the string in Arduino

Yash Sanghvi

Yash Sanghvi

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

In case you don’t want to overwrite a string, but just change a character at a specific position, Arduino provides the setCharAt() function exactly for that.SyntaxString1.setCharAt(ind, new_char);String 1 is the string to modify. ind is the index where the character needs to be set. new_char is the value of the new ... Read More

Get ASCII table in Arduino

Yash Sanghvi

Yash Sanghvi

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

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

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

Advertisements