Hello everyone, I'm new in the world of Arduino and I can not do a thing, I have arduino; sd with the shield and I would read the number in a file inside the sd (number between 0 and 1000) and use it as a value to be incremented by pressing a button ... but I can not do it because from what I understand it is not enough do
myFile = SD.open("conta1.txt", FILE_READ);
if (myFile) {
while (myFile.available()) {
Serial.write(myFile.read());
int value = myFile.read()
}myFile.close();};}
(excuse the language but I'm using google translator)
while (myFile.available()) {
Serial.write(myFile.read());
int value = myFile.read()
Read one character, and write it to the serial port.
Read the next character, and store it in a local variable that immediately goes out of scope.
End result? Nothing useful.
If you are able to use google translate, I'm sure that you are able to use google search.
Reading data from a stream, whether from an ethernet shield, a SD card, or the serial port, and storing it in an array is a topic that comes up every day. Robin2 has some sticky posts on the subject of reading from the serial port. The concepts are exactly the same when reading from an SD card, instead.