Python and the Internet of Things Hack Chat

Join us Wednesday at noon Pacific time for the Python and the Internet of Things Hack Chat!

Opinions differ about what the most-used programming language in right now is, but it’s hard to deny both the popularity and versatility of Python. In the nearly 30 years since it was invented it has grown from niche language to full-blown development environment that seems to be everywhere these days. That includes our beloved microcontrollers now with MicroPython, and Adafruit’s CircuitPython, greatly lowering the bar for entry-level hackers and simplifying and speeding development for old hands and providing a path to a Python-powered Internet of Things.

The CircuitPython team from Adafruit Industries – Dan Halbert​, Kattni Rembor​, Limor “Ladyada” Fried​, Phillip Torrone​, and Scott Shawcroft – will drop by the Hack Chat to answer all your questions about Python and the IoT. Join us as we discuss:

  • How CircuitPython came to be;
  • The range of IoT products that support Python;
  • Getting started with Python on IoT devices; and
  • What’s on the horizon for a Python-powered IoT?

And as extra enticement, we’ll be giving away five free one-year passes to ​​! We’ll draw five names at random from the list of Hack Chat attendees. Stop by for a chance to win. And, the Adafruit team will be streaming video live during the Hack Chat as well.

You are, of course, encouraged to add your own questions to the discussion. You can do that by leaving a comment on the Python and the Internet of Things Hack Chat and we’ll put that in the queue for the Hack Chat discussion.

join-hack-chatOur Hack Chats are live community events on the Hack Chat group messaging. This week we’ll be sitting down on Wednesday, April 3, at noon, Pacific time. If time zones have got you down, we have a handy time zone converter.

Click that speech bubble to the right, and you’ll be taken directly to the Hack Chat group on You don’t have to wait until Wednesday; join whenever you want and you can see what the community is talking about.

Want a quick peek at what’s possible with CircuitPython? Check out this PyPortal event countdown timer that just happens to be counting down the hours till the next Hack Chat.

ESP8266 Gets Its Game On With Open Source Engine

This is likely not to come as much of a shock to you, but the ESP8266 is pretty popular. At this point, we’re more surprised when a project that hits the tip line doesn’t utilize this incredibly cheap WiFi-enabled microcontroller. If you’re making a gadget that needs to connect to the Internet, there’s a good chance some member of the ESP family is going to be a good choice. But is it a one-trick MCU?

ESP Little Game Engine Logo

Well, judging by software frameworks like the “Little Game Engine” created by [Igor], it looks like the ESP is expanding its reach into offline projects as well. While it might not turn the ESP8266 into a next-gen gaming powerhouse, we’ve got to admit that the demos shown off so far are pretty impressive. When paired with a couple of buttons and a TFT display such as the ILI9341, the ESP could make for a particularly pocket-friendly game system.

The game engine that [Igor] has developed provides the programmer with a virtual screen resolution of 128×128, a background layer, and 32 sprites which offer built-in tricks like collision detection and rotation. All while running at a respectable 20 frames per second. This environment is ideal for the sort of 2D scrolling games that dominated the 8 and 16-bit era of gaming, and as seen in the video after the break, it can even pull off a fairly decent clone of “Flappy Bird”.

In addition, [Igor] created an online emulator and compiler which allows you to develop games using his engine right in your web browser. You can load up a selection of example programs and execute them to see what the engine is capable of, then try your hand at developing your own game before ever having to put the hardware together. Incidentally, the performance of this online development environment is fantastic; with even the fairly complex “Flappy Bird” example code compiling and starting in the emulator nearly instantaneously.

This isn’t the first handheld game we’ve seen powered by the ESP8266, but it would be fair to say this one is a generational leap over its predecessors. Of course, if you really want to start throwing around some pixels, you might want to make the leap to the ESP32; which is the heart of the incredibly awesome (and tiny) PocketSprite.

Continue reading “ESP8266 Gets Its Game On With Open Source Engine”

A Compiler in Plain Text Also Plays Music

As a layperson reading about some branches of mathematics, it often seems like mathematicians are just people who really like to create and solve puzzles. And, knowing that computer science shares a lot of its fundamentals with mathematics, we can assume that most computer scientists are also puzzle-solvers as well. This latest project from [tom7] shows off his puzzle creating and solving skills with a readable file which is also a paper, which is also a compiler for C programs, which can also play music.

[tom7] started off with the instruction set for the Intel 8086 processor. Of the instructions available, he wanted to use only instructions which are also readable in a text file. This limits him dramatically in what this file will be able to execute, but also sets up the puzzle. He walks through each of the hurdles he found by only using instructions that also code to text, including limited memory space, no obvious way of exiting the program once it was complete, not being able to jump backward in the program (i.e. looping), and a flurry of other issues that come up once the instruction set is limited in this way.

The result is a sort of C compiler which might not be the most efficient way of executing programs, but it sure is the most effective way of showing off [tom7]’s PhD in computer science. As a bonus, the file can also play an antiquated type of sound file due to one of the available instructions being a call for the processor to interact with I/O. If you want to learn a little bit more about compilers, you can check out a primer we have for investigating some of their features.

Thanks to [Greg] for the tip!

Continue reading “A Compiler in Plain Text Also Plays Music”

Tiny Programming Language in 25 Lines of Code

There are certain kinds of programs that fascinate certain kinds of software hackers. Maybe you are into number crunching, chess programs, operating systems, or artificial intelligence. However, on any significant machine, most of the time those activities will require some sort of language. Sure, we all have some processor we can write hex code for in our head, but you really want at least an assembler if not something sturdier. Writing languages can be addictive, but jumping right into a big system like gcc and trying to make changes is daunting for anyone. If you want a gentle introduction, check out [mgechev’s] language that resides in 25 lines of Javascript.

The GitHub page bills it as a tiny compiler, although that is a bit misleading and even the README says it is a transpiler. Actually, the code reads a simple language, uses recursive descent parsing to build a tree, and then uses a “compiler” to convert the tree to JavaScript (which can then be executed, of course). It can also just interpret the tree and produce a numerical answer.

Continue reading “Tiny Programming Language in 25 Lines of Code”

Disrupting The Computer Industry Before it Existed: Rear Admiral Grace Hopper

The feature of being easier to write than assembly is often seen as the biggest advantage of high-level programming languages. The other benefit that comes with them is portability. With high-level languages, algorithms can be developed independently from the underlying hardware. This allows software to live on once the hardware becomes obsolete.

The compiler was a concept that was met with resistance when it was first introduced. This was at a time when computers were custom-built machines bearing individual names like ENIAC, UNIVAC and Mark I. A time when the global demand for computers was estimated to be around five units by the CEO of IBM. In this scenario, it took a visionary to foresee a future where the number of computers would outgrow the number of programmers and hardware would evolve so much faster than software that a compiler would make sense. One visionary was [Grace Hopper].

Continue reading “Disrupting The Computer Industry Before it Existed: Rear Admiral Grace Hopper”

Language Parsing with ANTLR

There are many projects that call out for a custom language parser. If you need something standard, you can probably lift the code from someplace on the Internet. If you need something custom, you might consider reading [Federico Tomassetti’s] tutorial on using ANTLR to build a complete parser-based system. [Frederico] also expanded on this material for his book, but there’s still plenty to pick up from the eight blog posts.

His language, Sandy, is complex enough to be a good example, but not too complex to understand. In addition to the posts, you can find the code on GitHub.

Continue reading “Language Parsing with ANTLR”

A Real Hacker’s IDE

We don’t use a GUI IDE, but if we did, it would most certainly be something along the lines of [Martin]’s embedded-IDE project. We’ve always felt that most IDEs are just fancy wrappers around all the tools that we use anyway: Makefiles, diff, git, ctags, and an editor. [Martin]’s project makes them less fancy, more transparent, and more customizable, while retaining the functionality. That’s the hacker’s way — putting together proven standard tools that already work.

The code editor he uses is QScintilla, which uses clang for code completion. The “template” system for new projects? He uses diff and patch to import and export project templates. Because it uses standard tools all along the way, you can install the entire toolchain with sudo apt-get install clang diffutils patch ctags make on an Ubuntu-like system. Whatever compiler you want to use is supported, naturally.

We can’t see a debugger interface, so maybe that’s something for the future? Anyway, if you want a minimalistic IDE, or one that exposes the inner workings of what it’s doing rather than hiding them, then give [Martin]’s IDE a try. If you want more bells and whistles that you’re not going to use anyway, and don’t mind a little bloat and obscuration, many of our writers swear by Eclipse, both for Arduino and for ARM platforms. We’ll stick to our butterflies.