Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Michal Rybka
openCanSat-2.0-library
Commits
9b03747a
Commit
9b03747a
authored
Aug 19, 2018
by
Markéta Jedličková
Browse files
New name of file changed from test.txt to data.txt
parent
82b15ea6
Changes
1
Hide whitespace changes
Inline
Side-by-side
SD_card_test.ino
View file @
9b03747a
...
...
@@ -38,20 +38,21 @@ void setup()
// begin communication with the SD card using the previously specified pin
// print an error to the serial in case the SD card is not found
if
(
!
SD
.
begin
(
cs_pin
))
{
if
(
!
SD
.
begin
(
cs_pin
))
{
Serial
.
println
(
"SD card initialization failed!"
);
return
;
}
Serial
.
println
(
"SD card initialized"
);
file
=
SD
.
open
(
"
test
.txt"
,
FILE_WRITE
);
// open test.txt for write
file
=
SD
.
open
(
"
data
.txt"
,
FILE_WRITE
);
// open test.txt for write
// write to the file and print info to serial
// print an error to the serial in case it does not succeed
if
(
file
)
{
Serial
.
println
(
"Writing to
test
.txt"
);
Serial
.
println
(
"Writing to
data
.txt"
);
file
.
println
(
"openCanSat SD card test"
);
file
.
close
();
...
...
@@ -59,26 +60,26 @@ void setup()
}
else
{
Serial
.
println
(
"Error opening
test
.txt for writing"
);
Serial
.
println
(
"Error opening
data
.txt for writing"
);
}
// read the test.txt and print it to serial
// print an error to the serial in case it does not succeed
file
=
SD
.
open
(
"
test
.txt"
);
if
(
file
)
file
=
SD
.
open
(
"
data
.txt"
);
if
(
file
)
{
Serial
.
println
(
"
test
.txt:"
);
Serial
.
println
(
"
data
.txt
:"
);
while
(
file
.
available
())
{
Serial
.
write
(
file
.
read
());
}
file
.
close
();
Serial
.
println
(
"Reading from
test
.txt finished"
);
Serial
.
println
(
"Reading from
data
.txt finished"
);
}
else
{
Serial
.
println
(
"Error open
ing test.txt for reading
"
);
Serial
.
println
(
"Error
to
open
data.txt
"
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment