One of the sticking points for us with our own Internet of Things is, ironically, the Internet part. We build hardware happily, but when it comes time to code up web frontends to drive it all, the thrill is gone and the project is only half-done.
Including some simple web-based scripting functionality along with the microcontroller basics is one of the cleverest tricks up ESP8266 BASIC’s sleeves. BASIC author [mmiscool] puts it to good use in this short demo: a complete learning IR remote control that’s driven through a web interface, written in just a few lines of BASIC.
Note that everything happens inside the ESP8266 here, from hosting the web page to interpreting and then blinking back out the IR LED codes to control the remote. This is a sophisticated “hello world”, the bare minimum to get you started. The interface could look slicker and the IR remote could increase its range with more current to the LED, but that would involve adding a transistor and some resistors, doubling the parts count.
For something like $10 in parts, though, this is a fun introduction to the ESP and BASIC. Other examples are simpler, but we think that this project has an awesome/effort ratio that’s hard to beat.
Well the webification of interfaces is proceeding normally. One of these days we’ll tell our grand-kids, “back in my day we used a native interface, and we liked it”.
It’ll be weird when a touchscreen LCD is cheaper than half a dozen simple buttons. Actually we’re probably approaching that date soon.
Creating a rich web interface isn’t that hard especially with technologies such as angular and webdocket mqtt. The more challenging thing is to split the interface from the device itself and still be reasonably responsive. Many cloud based IoT companies do the UI well but being in the cloud makes the response time well above the Doherty threshold unless it is carefully designed to also have local control.
if you want to obfuscate the web, use Angular…. I don’t think it’s worth though
Mike has done a wonderful job with this ESP8266 Basic…. dedicated from day 1! Good job! You can find 5,000+ posts with regards to this here http://www.esp8266.com/u/basic (only 2nd to the Arduino thread)
Does it handle long ir-codes like AC-units?
Great use of Basic..
Alternatively you could also try micropython. E.g. https://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/network_tcp.html
Only one problem, it uses Basic. Seriously I’ve been forced to use basic on a project or two in the past and I’d never do it voluntarily even if the end result was acceptable. I would never use it for teaching either, it is a dusty dead end road of harmful habits.
What’s wrong with it? In this case it’s just a scripting language
Other than, “it is a dusty dead end road of harmful habits.”?
You say that, I don’t see that.
Well I’ve used Basic, and not used Basic, so I can see that not using Basic is a better choice. Have you only ever used Basic? LOL
I used (and still do) BASIC in several flavors and it does not seem dead to me. The fact that it allows harmful habits does not equals that it enforces harmful habits. Don’t see any harm using it if it gets a job done in the time available.
Of course, it’s not as if I would insist in writing a SQL database server in BASIC, to each problem its tool.
Depends what you’re doing with it. Like most tools really. For quick ‘n’ dirty, reliable, fire and forget coding, can’t go wrong. No need to worry about memory allocations and pointers and stuff like in C. Of course you don’t HAVE to use those in C either, but chances are if there’s a bug, you’re gonna end up with your sleeves rolled up, into the guts soon enough.
BASIC’s also really easy and small to implement, and pretty much everyone knows it. And if you’re a programmer who doesn’t know BASIC, it’ll take you all of 5 minutes to get the hang.
Of course there’s BASIC with pointers, and doublewords, and bloody object orientation. That’s taking BASIC where it was never meant to go, and has no business being. Code like that ends up looking like C even if it’s supposedly in BASIC. For C programmers who just can’t let go, I suppose.
For quick ‘n’ dirty hardware, but also for software where it’s a decent alternative to scripting also. Like Visual Basic, back in the early days. A lot of bespoke software was really just a front-end and a bit of simple logic tying together the libraries that did the real work. So wrap a bit of BASIC around that, Bob’s yer uncle.
BASIC has it’s place. So does awful coding. But the two don’t have to go together.
it would be nice if it would automatically create a new button/action on the web page when it reads a new code from an IR remote
I use a few ESP8266 around the house to monitor power usage at the meter, water tank temperature and controlling my garden watering. I have created a web interface (a basic API) on each ESP8266 which is called from a central computer to retrieve readings or switch relays. The readings are pushed into a Influx database for graphing or switching.
Care to share? :-)
The thing here is that esp8266basic allows you to do simple stuff really easily. And remotely.
Its pretty cool, was less difficult to set up that micropython , which I also like :)