
13
85.
// print the buffer length. This will change depending on when
86.
// data is actually written to the SD card file:
87.
Serial
.
(
"Unsaved data buffer length (in bytes): "
)
;
88.
Serial
.
println
(
buffer.
length
())
;
89.
// note the time that the last line was added to the string
90.
lastMillis
=
now
;
91.
}
92.
93.
// check if the SD card is available to write data without blocking
94.
// and if the buffered data is enough for the full chunk size
95.
unsigned
int
chunkSize
=
txtFile.
availableForWrite
()
;
96.
if
(
chunkSize
&&
buffer.
length
()
>=
chunkSize
)
{
97.
// write to file and blink LED
98.
digitalWrite
(
LED_BUILTIN
,
HIGH
)
;
99.
txtFile.
write
(
buffer.
c_str
()
,
chunkSize
)
;
100.
digitalWrite
(
LED_BUILTIN
,
LOW
)
;
101.
102.
// remove written data from buffer
103.
buffer.
remove
(
0
,
chunkSize
)
;
104.
}
105.
}
Содержание WPI304N
Страница 1: ...MANUAL EN microSD Card Logging Shield for Arduino WPI304N whadda com ...
Страница 5: ...5 Circuit Diagram ...