Here is my new serial starting code.
It takes some time to start printing the serial after the command is set. Usually you simply add a delay, but that delay can be longer than the time your serial takes to connect, so you're waiting for nothing and when you're trying to troubleshoot that becomes frustrating. The other option is the check if the serial started with while (!Serial) { delay(10); }
but then your code doesn't run without a serial connection so it just hangs if you try it off a battery or USB charger block.
Here comes the best of both worlds!
It checks for a serial connection every 10 ms but only for 3 seconds, then it goes on. The commented out line is to print how long it takes for your serial to show up. It was useful to determine 3s was a good number (I landed around 2100 to 2700 ms so 3000 gives me just a bit of padding while still being fairly fast when not plugged to a serial console.
Bonus is the giant ASCII START logo I made so I can easily see where it started when scrolling back up.
You can throw this at the top of your setup()
or even better, make it a function and call it, so you only need to comment out a single line when you go testing it without a computer and save those precious 3 seconds at startup.
Enjoy!
Serial.begin(115200);
unsigned long time_begin = millis();
while (!Serial && (millis() - time_begin) < 3000) {
delay(10);
// Serial.println(millis() - time_begin);
}
delay(10);
Serial.println(" ");
Serial.println(" :::::::: ::::::::::: ::: ::::::::: ::::::::::: ");
Serial.println(" :+: :+: :+: :+: :+: :+: :+: :+: ");
Serial.println(" +:+ +:+ +:+ +:+ +:+ +:+ +:+ ");
Serial.println(" +#++:++#++ +#+ +#++:++#++: +#++:++#: +#+ ");
Serial.println(" +#+ +#+ +#+ +#+ +#+ +#+ +#+ ");
Serial.println(" #+# #+# #+# #+# #+# #+# #+# #+# ");
Serial.println(" ######## ### ### ### ### ### ### ");
Serial.println(" ");
Serial.println(" ");
PS: it looks like Lemmy can't handle color coded markdown... :(
Then you try to charade what they look like, then your coworker starts going down a list of other coworkers names and you’re like “Honey, I don’t know anyone’s name, not even yours. Except of Charley from accounting, he as the same name as my nephew, he also kinda looks like him, but as a grown ass man. Then you wonder what would happen if they met, would they become friends? They don’t have much else in commun though… anyways, I don’t know who I spoke to, sorry.
Edit: I didn’t proof read my post until it was posted.
Once again I messed the pill count and didn’t renew my prescription in time sol I’ll be riding this coming week dry… thanks stupid US medical system.
UPDATE: I had to pay out of pocket. $120 because my doc didn’t fill some random paper so I could get the meds, but insurance won’t cover it. It takes 6 months to get an appointment with my doc. I saw him last week and he said he would send a refill, he did t. My pharmacy the requested after I called to check. No go. I called the nurse and asked — automated voicemail. I’m done. I’m done I’m done.
@LazaroFilm
@lemmy.film