The File.readBytes() function read characters from a file into a buffer. The function terminates if the determined length has been read, or it times out (see setTimeout()).
The File.readBytes() function returns the number of bytes placed in the buffer. A 0 means no valid data was found.
The File.readBytes() function inherits from the Stream utility class.
- file: an instance of a class that inherits from File.
- buffer: the buffer to store the bytes in. Allowed data types: array of char or byte.
- length: the number of bytes to read. Allowed data types: int.
- The number of bytes placed in the buffer. Data type: size_t.
- Connect the SD Card to your your PC via an USB 3.0 SD Card Reader
Create a arduino.txt file with the below content
- Connect SD Card to Arduino. See Arduino - Micro SD Card tutorial
- Upload below code to Arduino via Arduino IDE
- Open Serial Monitor, you will see as below: