Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Arduino Core for SAMD21 CPU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
Arduino Core for SAMD21 CPU
Commits
9b7a276b
Commit
9b7a276b
authored
8 years ago
by
Arturo Guadalupi
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #220 from sandeepmistry/sdu-usage-example
Add SDU usage example
parents
91bee1d2
c8b39d8a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/SDU/examples/Usage/Usage.ino
+73
-0
73 additions, 0 deletions
libraries/SDU/examples/Usage/Usage.ino
with
73 additions
and
0 deletions
libraries/SDU/examples/Usage/Usage.ino
0 → 100644
+
73
−
0
View file @
9b7a276b
/*
Usage
This example demonstrates how to use the SAMD SDU library to update a
sketch on an Arduino/Genuino Zero, MKRZero or MKR1000 board using an
SD card. It prints out the date and time the sketch was compiled at
to both Serial and Serial1.
Circuit:
* Arduino MKRZero board with SD card
OR
* Arduino/Genuino Zero or MKR1000 board
* SD shield or breakout connected with CS pin of 4
* SD card
Non-Arduino/Genuino Zero, MKRZero or MKR1000 board are NOT supported.
Steps to update sketch via SD card:
1) Upload this sketch or another sketch that includes the SDU library
via #include <SDU.h>
2) Update the sketch as desired. For this example the sketch prints out
the compiled date and time so no updates are needed.
3) In the IDE select: Sketch -> Export compiled Binary
4) Copy the .bin file from the sketch's folder to the SD card and rename
the file to UPDATE.bin. Eject the SD card from your PC.
5) Insert the SD card into the board, shield or breakout and press the
reset button or power cycle the board. The SDU library will then update
the sketch on the board with the contents of UPDATE.bin
created 23 March 2017
by Sandeep Mistry
*/
/*
Include the SDU library
This will add some code to the sketch before setup() is called
to check if an SD card is present and UPDATE.bin exists on the
SD card.
If UPDATE.bin is present, the file is used to update the sketch
running on the board. After this UPDATE.bin is deleted from the
SD card.
*/
#include
<SDU.h>
String
message
;
void
setup
()
{
Serial
.
begin
(
9600
);
Serial1
.
begin
(
9600
);
// wait a bit
delay
(
1000
);
message
+=
"Sketch compile date and time: "
;
message
+=
__DATE__
;
message
+=
" "
;
message
+=
__TIME__
;
// print out the sketch compile date and time on the serial port
Serial
.
println
(
message
);
Serial1
.
println
(
message
);
}
void
loop
()
{
// add you own code here
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment