Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Arduino variables loaded from SD card

I am trying to load some variables from an SD card on the start up of my arduino Uno. I have been given some advice but am unable to communicate at the same hours. Using this advice, I have the following edited code, but it doesn't work and I believe that it's my implementation that is the problem. All help would be greatly appreciated.

myFile = SD.open("test.txt", FILE_READ);
 if (myFile) {
 while (myFile.available()) {
 myFile.read();
 km = myFile.parseInt();
 kmTemp = myFile.parseFloat();
 kmrevs = myFile.parseInt();
 miles = myFile.parseInt();
 milesTemp = myFile.parseFloat();
 milesrevs = myFile.parseInt();
 }
 myFile.close();
 }
 else {
 Serial.println("Read Error");
 }

Answer*

Draft saved
Draft discarded
Cancel
2
  • Hi there is no commas, it's just in the comments section, whenever I press enter it posts the message instead of starts a new line....so I used commas to seperate the different data. Commented May 6, 2018 at 21:47
  • Hi Juraj. I have to admit, I have never analysed anything as much as your two answers. I feel that my bank holiday was no longer wasted as I have finally worked out what you meant. All is rolling amazingly now and it's just what I wanted. Thank you. Commented May 8, 2018 at 10:14

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /