This is a special version of the basic Blink example. It's made for demonstrating how to enable the possibility to upload a sketch on a DUE board and a Yún shield using the remote upload feature (via Wi-Fi or Ethernet) offered by the Arduino Software (IDE).
The only instruction added to the basic Blink is the
checkForRemoteSketchUpdate()
function. As suggested by the name this instruction is responsible to check if there is a new sketch to upload on the board. This is required only on the Due because you need to erase the flash before uploading a new sketch. The same action is performed automatically when you upload a sketch using any of the USB ports.
To enable the remote upload feature you need to upload this sketch the first time with the USB cable and then make sure you will include the checkForRemoteSketchUpdate()
function in all other sketches at the beginning of the setup() function. If you forget to include it, you will need to upload the sketch again via USB port; it could be a voluntary choice to stop the remote upload functionality.Arduino DUE board
Yún shield (optional, for subsequent remote upload via WiFi)
The sketch must be uploaded using USB, then the next upload may use the Yún Shield and WiFi.
image developed using Fritzing. For more circuit examples, see the Fritzing project page
The complete sketch is below :
1/*2
3 Blink4
5 Turns on an LED on for one second, then off for one second, repeatedly.6
7 Most Arduinos have an on-board LED you can control. On the Uno and8
9 Leonardo, it is attached to digital pin 13. If you're unsure what10
11 pin the on-board LED is connected to on your Arduino model, check12
13 the documentation at http://www.arduino.cc14
15 This example code is in the public domain.16
17 modified 8 May 201418
19 by Scott Fitzgerald20
21 modified by Marco Brianza to show the remote sketch update feature on Arduino Due using Yún Shield22
23 */24
25#include <Bridge.h>26
27// the setup function runs once when you press reset or power the board28void setup() {29
30 checkForRemoteSketchUpdate();31
32 // initialize digital pin 13 as an output.33
34 pinMode(13, OUTPUT);35}36
37// the loop function runs over and over again forever38void loop() {39
40 digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)41
42 delay(100); // wait for a second43
44 digitalWrite(13, LOW); // turn the LED off by making the voltage LOW45
46 delay(100); // wait for a second47}
Last revision 2016/05/25 by SM