Seen a few posts on "how do I know my sketch loader / is working.
Well, assuming that you have successfully got your Oak setup and on particle and have run the Oak CLI in to select the Oak you are going to use to upload to, this first sketch (has not bricked) will put out a unique LED pattern that is distinct from the upload pattern. If you are running it for the first time you will see a (about) 1/2 second LED duty cycle which is an indication of the upload, then a blank LED for a few seconds, then the unique LED flash pattern (slow to fast flash) running from setup(), then the slow 3 second duty cycle LED flash in loop(). Hasn't bricked and I am now confident that I can successfully upload using the Arduino IDE. Hope this is useful to others. I am a happy camper. Here's to no bricking and on to more complex sketches.
NOTE: I'm using Particle.delay as required for the Oak.
The upload for this takes about 2 minutes on my net.
Here is the sketch...
#define OakLEDPin 1
void setup() {
// initialize the digital pin as an output.
pinMode(OakLEDPin, OUTPUT); //Oak LED
// Put out a unique LED pattern to indicate sketch start
OakLEDRun(OakLEDPin);
}
// the loop routine runs over and over again forever:
void loop() {
// slow blink
digitalWrite(1, HIGH); // turn the LED on (HIGH is the voltage level)
Particle.delay(3000);
digitalWrite(1, LOW); // turn the LED off by making the voltage LOW
Particle.delay(3000);
}
//Puts out a unique LED pattern to indicate sketch start
void OakLEDRun(int pin) {
int i, n;
for(n=0; n<3; n++) {
for(i=0; i<3; i++) {
digitalWrite(1, HIGH); // turn the LED on
Particle.delay(1000);
digitalWrite(1, LOW); // turn the LED off
Particle.delay(500);
digitalWrite(1, HIGH); // turn the LED on
Particle.delay(500);
digitalWrite(1, LOW); // turn the LED off
Particle.delay(250);
digitalWrite(1, HIGH); // turn the LED on
Particle.delay(250);
digitalWrite(1, LOW); // turn the LED off
Particle.delay(125);
digitalWrite(1, HIGH); // turn the LED on
Particle.delay(125);
digitalWrite(1, LOW); // turn the LED off
Particle.delay(60);
digitalWrite(1, HIGH); // turn the LED on
Particle.delay(60);
digitalWrite(1, LOW); // turn the LED off
Particle.delay(30);
} // end for (i..)
Particle.delay(1000);
} // end for(n...)
} // end OakLEDRun