
If you really want to make sure you save every data point, put a
logfile.flush();
right after the logfile.print's however this will cause the adalogger to draw a lot more
power, maybe about 3x as much on average (30mA avg rather than about 10mA)
Downloads
Frizting object in the Adafruit Fritzing Library
(https://adafru.it/aP3)
https://adafru.it/z3c
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
logfile = SD.
open
(filename, FILE_WRITE);
if
( ! logfile ) {
Serial.
(
"Couldnt create "
);
Serial.
println
(filename);
error
(
3
);
}
Serial.
(
"Writing to "
);
Serial.
println
(filename);
pinMode
(
13
, OUTPUT);
pinMode
(
8
, OUTPUT);
Serial.
println
(
"Ready!"
);
}
uint8_t
i=
0
;
void
loop
() {
digitalWrite
(
8
, HIGH);
logfile.
(
"A0 = "
); logfile.
println
(
analogRead
(
0
));
Serial.
(
"A0 = "
); Serial.
println
(
analogRead
(
0
));
digitalWrite
(
8
, LOW);
delay
(
100
);
}
hosted with
❤
by
•
•
©Adafruit Industries
Page 38 of 39