In this section you will learn
Remember, hand written notes are really important.
Make notes on things that trip you up, things you understand in your own words, things that you want to look further into or places to look at later (python programming tutorials etc) and your findings as you go through.
The more work you put in here that we can use to prove you've been learning things, the less other work you have to do! Be kind to yourself, spend a little extra time on this, or spend a lot of time later because you didn't..
Yeah that sounds REALLY simple doesn't it?
And it is :)
No, really, it really is!
..there's a gotcha though, but I'll be doing most of the hard work in finding the things you need to know and putting them in front of your face when you need it.
So, in the last Section_2 - Lets_Talk we saw some rather simple Python code that turned an LED on and off, but wouldn't you know it, lifes not that simple.
GPIO pin addresses can be weird, man, just weird. Something says 'pin 0', but does that mean 0 as printed on the board, GPIO 0 or D0? Who knows?!
So, here's a helpful tip, this ESP 8266 is a clone of a Wemos D1 Mini. One of these: https://shop.rasp.io/products/wemos-d1-mini-esp8266?variant=3485595336727
Well that looks just the same doesn't it?
![]()
And that's because what we have is called a 'cheap-assed-ripoff-clone' but given that Wemos are a company that made their money and status by mass-producing cheap-assed-ripoff-clones of the extremely popular NodeMCU development board, which nearly brought the NodeMCE project down which was the backbone of the maker movement into ESP8266 as a simple development platform, I don't really feel all that bad about the whole thing.
..but being a ripoff they tend to save themselves a whole load of development time and copy it exactly, so anywhere we find information on a Wemos D1 Mini it's very likely to be true for ours.
Random Nerd Tutorials - esp8266 pin ref
..well, would you look at that. It shows us GPIO vs D numbers! This is called a pinout.
So now we know that, we can look around for other stuff. So, what do we want to do? Turn a specified pin on.
..lets pretend we didn't cover exactly that in the previous Section, and go look at where the best place to do this is. We could scour all sorts of places, youtube, ask random people on the street (make sure you keep at least 2 meters distant, they will understand why you are shouting) or we could just go here:
Micro Python - Quick Reference - Pins and GPIO
Yes I'm a git, this is exactly where I got the previous Sections code from, because although quite odd, I am not a mental. I would much rather read the official documentation for a code language than blind smash the keyboard in the hope that this time I might just get lucky :D
So, here's the thing. That pin assignment for the output pin is likely wrong, you will need to work that out.
Also the input pin stuff is completely irrelevant to us, dont use it.
And here's the 'ooooh nooo!' bit. All this needs to be in a loop.
Now you could run it in an infinite loop, but don't. It wont hurt anything but it is annoying. Also it will teach you how to do a Python While Loop (and remember, W3 Schools is fine, we wont tell anyone you went there, there's plenty of hot water in the tank for a long shower afterwards, the smell will fade).