Miscelleneous ESP32 sketches for your en-joyment.
I guess I "got back into" electronics; researching robotics resources for my eldest when I came across these wonderful wee ESP32 devices, of which I now own a few. Big fun!
Also a few quick snaps (taken with my phone!) which you may find useful.
Linux works best for programming micro-controllers. I switched the bulk of my operations to Linux years ago, after Slackware-current went Plasma desktop, and haven't looked back (I always ran a Slackware box, but usually doing more less user-orientated stuff and definitely not /my desktop/). I test these scripts on Windows but it's a nightmare compared to the ease and integration of working in Linux.
CH340* works. Brilliantly. ALL my modules upload at full speed (921600 beats per minute, or it could be baud; fast, anyway). When I buy modules I look for USB-C and CH340 UART chips because I know that they will work on any platform of any version (I mean common modern platforms, minimum being Win7+-ish) at top speed. What more do you need?
Of course, Linux users don't need to think about this; it will just happen. *grin*
About cheap AliExpress Modules..
BE CAREFUL.. I think that if you are really skint and can afford to really take your time fishing for well-known and well-reviewed units you can save a few bucks. No doubt.
The unwary can easily waste amounts which seemed like bargains at the time but will fail the instant you slam some blu-tack on the back and attach it to a lamp, or whatever. I'm talking about shoddy workmanship.
I've been right there at the peak of my AliExpress Pleasure Feed-back Loop and WHAM! My penis, I mean module, is ripped right out of my life, existing only by its bare, un-pinned holes; no longer fit for regular flashing; a reject.
There are some conscientious Eastern manufacturers out there worth our respect and bucks for bringing innovative new designs to the market at low cost, but after a few bucks tossed Eastwards myself, I'm inclined to recommend serious makers invest in manufacturers with more rigorous quality controls and some skin in the open source game..
Guys like Adafruit, who's devices might seem more expensive at first, but pay back the difference with way-increased longevity and perhaps more importantly, significant contributions to the publicly-available micro-controller libraries. That 99p OLED display from AliExpress isn't gonna work without Adafruit libraries. Fact. They invested.
I haven't tested this, but I bet if you contacted Adafruit (or similar quality outfit) and said "Fuck guys! This thing just stopped functioning after I blew on it", they would be all over it, FedExing you a replacement and apologising profusely, and massaging your life in all sorts of pleasurable ways.
Try the same thing with an AliExpress seller. Insert long pause. Sure, you could get a refund - Ali is Shit-Hot with refunds these days - but think of what has been lost..
All that excitement, all that expectation, the unwrapping and plugging in, the uploading and then, after gently blowing on the unit, BOOM! Your entire city and its surrounding arable lands are engulfed in a nuclear fireball, or maybe it just stops working, but either way, your weekend is fucked. Worth the five bucks you "saved"? Pfff...
No. Never happened to me. Nope. Nonoononon. F*CK! Grrrrr.
OKAY, I right now have a could-have-been-lovely ESP32+OLED module sitting in a breadboard, attached to a UART programmer because well, the microUSB socket just fell off. And it's not even the module I ordered (The original WeMos unit, thank you; not this cheap clone). BE CAREFUL, is what I'm saying. Forget warranty. Forget customer support. You are on your own.
While I realise it must be hard for new manufacturer's to make their mark, it is doable, if they start big. But this isn't YOUR problem, is it? Don't fund shoddy manufacturers.
My advice: Unless you are purely in this "For Science!", purchase well-known kit.
I'm just gonna drop odd tips here, in the hope they might be useful..
If you are fortunate enough to own multiple ESP32 boards, be sure to edit your boards.txt* file to have all those boards up near the top of your list.
This will save you lots of time and frustration in the future, switching boards, as there are now over six million boards to scroll through, or thereabouts, perceptually-speaking.
* You thought I was just gonna give you the location of that file, didn't you? <Insert evil laugh> Get into your filesystem ffs! It will be in your home folder, in the
.arduino directory, I would imagine.
NOTE: When copying-and-pasting large sections like this I usually copy "WITH TOP DIVIDER", and I repeat this Mantra in my mind as I Cut the original section and then Paste it into its new location, with the "DIVIDER AT THE TOP. DIVIDER AT THE TOP. DIVIDER AT THE TOP."
Or bottom. Whatever works for you.