| 173 | } |
| 174 | |
| 175 | void readTest() |
| 176 | { |
| 177 | Serial.println(_F("3. Open file \"test.txt\" and read")); |
| 178 | |
| 179 | FIL file; |
| 180 | FRESULT fRes = f_open(&file, "test.txt", FA_READ); |
| 181 | |
| 182 | if(fRes == FR_OK) { |
| 183 | //read back file contents |
| 184 | char buffer[64]; |
| 185 | |
| 186 | uint32_t actual = 0; |
| 187 | f_read(&file, buffer, sizeof(buffer), &actual); |
| 188 | buffer[actual] = 0; |
| 189 | |
| 190 | Serial << _F("Read: ") << buffer << endl; |
| 191 | |
| 192 | f_close(&file); |
| 193 | } else { |
| 194 | Serial << _F("fopen FAIL: ") << fRes << endl; |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | bool speedTest(unsigned num) |
| 199 | { |