1/*
2 Usage
3 This example demonstrates how to use the SAMD SBU library to update a 
4 sketch on any Arduino MKR board via the storage on the SARA-R410M module.
5 This sketch prints out the current date and time.
6 Steps to update sketch:
7 1) Upload this sketch or another sketch that includes the SBU library
8 2) Update the sketch as desired. For this example the sketch prints out
9    the compiled date and time.
10 3) In the IDE select: Sketch -> Export compiled Binary
11 4) Open the location of the sketch and convert the .bin file to a C byte array.
12      cat SKETCH.bin | xxd --include > Binary.h
13 5) Copy Binary.h file from the sketch's folder to the SBU_LoadBinary sketch
14    and load it to the SARA-R410M via SBU_LoadBinary sketch.
15*/
16
17/*
18 Include the SBU library
19 
20 This will add some code to the sketch before setup() is called
21 to check if UPDATE.BIN and UPDATE.OK are present on the storage of
22 the SARA-R410M module. If this check is positive UPDATE.BIN is used to update
23 the sketch running on the board.
24 After this UPDATE.BIN and UPDATE.OK are deleted from the flash.
25*/
26
27
28#include <SBU.h>
29
30void setup()
31{
32  Serial.begin(9600);
33  while (!Serial) { }
34  // wait a bit
35  delay(1000);
36  String message;
37  message += "Sketch compile date and time: ";
38  message += __DATE__;
39  message += " ";
40  message += __TIME__;
41  // print out the sketch compile date and time on the serial port
42  Serial.println(message);
43}
44
45void loop()
46{
47  // add you own code here
48}
49