I have made a wireless automatic programmer for all esp8266 boards!!!! Everything was going great except I ran out of room on my atTiny85 as soon as I included the SoftwareSerial library.
My prototyping setup is a Wemos d1 mini(esp8266 version), an Hc-05 Bluetooth module, and an Arduino Uno(which acts like the atTiny85)
I was planning on reading the Serial to check if any character/vodoo/ shitty data/ crappy morse code was coming from the tx line of an esp8266. The reason why I say "shitty data" is because I only care if data is coming from the line when the Bluetooth module uploads code to the Wemos board(This way I know that code is being uploaded). The other annoying reason why I need to detect the tx line is that Whenever I open the Serial monitor to connect to the Bluetooth module, the Wemos board thinks its receiving code(But it isn't, so it crashes >:( ) This is why I need an Attiny85 to tell the Wemos the difference :), otherwise the serial monitor would be useless
I only have 1k bytes of memory left. Taking SoftwareSerial out frees over 50% :o
Could someone tell me a simpler approach to detect whether data is streaming in the tx lines of the Wemos(esp8266) board? My current (inefficient) code is this But of course, I won't show you all the code.
if(check){
if(count<300){
if (mySerial.available()) {
count=-1;
check=false;
Serial.println("esp8266 is receiving code");
resetted=false;
}
count++;
delay(5);
}
else{
digitalWrite(GPIOPin, HIGH);
delay(100);
digitalWrite(resetPin, LOW);
delay(100); //500
digitalWrite(resetPin, HIGH);
Serial.println("Serial Monitor opened");
resetted=true;
count=0;
check=false;
}
}
I'm basically checking if the Serial is available(or spitting crap) over a period of 1.5 seconds.
Yeah, yeah, I hear ya...Why Am I using delay, when I should be avoiding it...
Unfortunately I can't use Millis() cause that would take up more memory.
Note: My code works perfectly. The goal is to shrink my code, to make it more efficient. Taking SoftwareSerial out frees over 50% :o
I need an alternative to softwareSerial or a better way to determine if the code is being uploaded to the Wemos.