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
In this tutorial, we will create a new file in an SD Card connected to Arduino Uno.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 → DataloggerAlternatively, you can access the code on ... Read More
As the title suggests, in this tutorial, we will be listing the files stored in an SD Card connected to Arduino.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 → listfilesAlternatively, the code ... Read More
As the title suggests, in this tutorial, we will read a file from an SD Card connected to Arduino.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 → ReadWriteAlternatively, you can find the ... Read More
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 in the append mode only. Thereafter, myFile.println(dataString);appends to the existing file, and doesn’t overwrite the existing content.If you haven’t gone through any other articles on SD Card, I’d suggest reading the "Store a new file in SD Card connected to Arduino" article. That is a detailed article containing the circuit ... Read More
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 → CardInfoWe begin with the inclusion of ... Read More
Suppose we have two strings s and t, we have to check whether s can be converted to t in k moves or less. In ith move you can do these operations.Select any index j (starting from 1) in s, such that 1
Suppose we have two positive values n and k, now we can make a binary string S_n by using following rules −S_1 = 0S_i = S_i-1 concatenate "1" concatenate reverse(invert(S_i-1)) for i > 1Here reverse(x) returns the reversed string x, and invert(x) flips all the bits in x.These are the example of four such stringsS_1 = "0"S_2 = "011"S_3 = "0111001"S_4 = "011100110110001"We have to find kth bit in S_n.So, if the input is like n = 4 k = 10, then the output will be 1 because S_4 = "011100110110001", so 10th bit is 1 (first bit is at ... Read More
Suppose we have an array nums and another value called target. Now we have to find the maximum number of non-empty non-overlapping subarrays such that the sum of values in each different subarray is same as target.So, if the input is like nums = [3, 2, 4, 5, 2, 1, 5] target = 6, then the output will be 2 as there are two subarrays [2, 4] and [1, 5] whose sum is same as 6.To solve this, we will follow these steps −t := a new set with single element 0temp := 0ans:= 0for each i in nums, dotemp ... Read More
Suppose we have a value n, consider an array nums with n elements, where arr[i] = (2*i)+1 for all i. Now in one operation, we can choose two indices x and y where 0 =0, doans:= ans + (n-j)q := q - 1j := j + 2return ansLet us see the following implementation to get better understanding −Example Live Demodef solve(n): ans=0 if n==1: return ans q=(n//2)-1 j=1 while q>=0: ans=ans+(n-j) q-=1 j+=2 return ans n = 4 print(solve(n))Input4Output4
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP