The end goal is to use HC-12 to remotely upload to my project using a Mega board.
First step is to learn to upload without the auto reset.
Have setup and tried the sketch below but can not get it to take the upload.
My thoughts are that once the colon is detected, a reset is initiated, like the USB does on the board, but my circuit fails to start the bootloader (I think).
I also tried exporting the hex file and sending it with Mitty, same result.
It seems to me that the software will detect the first colon, do the reset, which should start the bootloader. Since the first line will have been messed up with the reset, the IDE should try again, starting the whole process correctly.
Is there some timing issue that is involved?
Has anyone come up with a way to upload to Arduino wireless?
I have tried the 8266, beyond my level of knowledge, the HC-12 just seemed like a good alternative, got them working Mega to Mega no problem.
Thank you in advance
Gary
const byte LED_PIN = 13;
const byte RST_PIN = 12;
/*
I understand that the output pins are taken low on startup,
so by doing a digital write first, to high
before the pin is made output this is avoided
This via Ralph S Bacon
*/
void setup() {
digitalWrite(RST_PIN, HIGH);
pinMode(RST_PIN, OUTPUT); // reset control
digitalWrite(LED_PIN, HIGH);
pinMode(LED_PIN, OUTPUT); // onboard LED
Serial.begin(9600);
Serial.println(" just did setup from a reset");
}
void loop() {
char receivedChar = '0';
if (Serial.available() != 0) {
receivedChar = Serial.read();
digitalWrite(LED_PIN, LOW); // turn off LED to show activity
Serial.println(receivedChar); // echo back char
if (receivedChar == ':') { // if a colon
digitalWrite(LED_PIN, HIGH); // turn on LED
Serial.println("got a colon");
delay(20); // unknown if helping by affects print above
digitalWrite(RST_PIN, LOW); // cause a reset
Serial.println("should never get here");
}
}
}
The reset trigger pin (12) is connected to the reset via a diode, anode to reset