Found 112 Articles for Arduino Boards

Understanding Arduino Uno pinout

Yash Sanghvi
Updated on 29-May-2021 13:51:31
The Arduino Uno board looks like the following −As you can see, the pins are broadly divided into 3 sections. Two sections at the bottom of the image, and one at the top.Let us look at the bottom sections.Section 1The first section contains power pins.The Vin pin can be used if you are using an external power source (and not the USB) to power the board. The recommended voltage range is 7-12 V.The 3.3V and 5V pins provide 3.3V and 5V outputs respectively, and should be used to power other components using the Arduino board. The maximum current from the ... Read More

Connect SD Card with Arduino and get Card Info

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 5V as input. If it takes in 3.3V, connect it to the 3.3V pin on Arduino Uno.Code WalkthroughWe will be walking through the example code that comes in with the inbuilt SD library. You can access it from File → Examples → SD → CardInfoAlternatively, you can access it on ... Read More

Wait for user input to start a sketch in Arduino

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 sketch only after an input is received from the user, via the Serial Monitor. This will ensure that you don’t miss any prints on the Serial Monitor because of the delay in starting the Serial Monitor.Examplevoid setup() {    // put your setup code here, to run once:    Serial.begin(9600); ... Read More

Read values sent by Serial Monitor to Arduino

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 Also, the Serial.available() function can be used to check if there is any data to read. It returns the number of characters or bytes available for reading, i.e., the number of bytes stored in the serial receive buffer.ExampleUsing these functions, let’s create a simple echo program for Arduino. The code for the same can be found below −void setup() {    // put your setup code here, to run once:   ... Read More

Switch case in Arduino

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 for value1       break;    case value2:       // statements for value2       break; . . .    default:       // statements for default value       break; }var is the variable whose different values we are checking. If its value ... Read More

Digital Read in Arduino

Yash Sanghvi
Updated on 29-May-2021 13:29:22
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 anything, it can return either HIGH or LOW, and this value can change with time and noise. Also, in general, analog pins can be used for digitalRead(). As stated in Arduino’s documentation, the following are the exceptions −Arduino Nano, Pro Mini, and Mini’s A6 and A7 pins, which can only ... Read More

Get ASCII table in Arduino

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 − 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

Set characters at a specific position within the string in Arduino

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 character that needs to be set.This function returns nothing, and modifies the string in place.ExampleThe following example illustrates the use of this function.void setup() {    // put your setup code here, to run once:    Serial.begin(9600);    Serial.println();    String string1 = "Hello World!";    Serial.println(string1);    string1.setCharAt(4, ... Read More

Compare Strings in Arduino

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 integer. Here’s the interpretation of the value of the integer −Negative − String1 comes before String20 − String1 and String2 are equalPositive − String2 comes before String1Please note that this function is case sensitive. So ‘A’ comes before ‘a’ and ‘B’ comes before ‘a’. But ‘a’ comes before ‘b’. Also, ... Read More

Reserve memory in Arduino for string manipulation

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 int) is the number of bytes to be reserved in the memory.ExampleString s1 = "Hello"; void setup() {    // put your setup code here, to run once:    Serial.begin(9600);    Serial.println();    s1.reserve(20);    s1 = s1+" World!";    Serial.println(s1);    s1 = s1+" I'm now trying ... Read More
Previous 1 ... 3 4 5 6 7 ... 12 Next