Hiya. Arduino noob here First post on forums.
I guess I am posting this for other noobs out there looking to implement a soft reboot into the code- ie: reprogramming mode
Copying from stevech above:
#define CPU_REBOOT (_reboot_Teensyduino_());
Then use CPU_REBOOT; in your loop.
//*****Example Code:********
Code:
/*
ON REBOOT: -Flashes LEDS five times quickly on reboot.
IN THE LOOP: -In the loop Flashes led once quickly, once not so quickly
-2 second pause and puts the Teensy 3.1 into Reboot Mode
NOTE: If Teensy application is set to auto, it will reload current hex file
*/
// Pin 13 has an LED connected on the Arduino 3.1 board.
#define CPU_REBOOT (_reboot_Teensyduino_());
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
digitalWrite(13, HIGH);
for(int i = 0; i < 10; i++){
digitalWrite(13, !digitalRead(13));
delay(50);
}
digitalWrite(led, LOW);
delay(500);
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for the blink of an eye
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for two seconds before reboot
// CPU_REBOOT ;
CPU_REBOOT ;
}