MakeCode and CODAL Ease The Way To Programming Electronics |
Written by Nikos Vaggalis |
Monday, 01 October 2018 |
Ever wanted to program electronics for either fun or profit but thought that the entry barrier was too high? Are you a teacher, a parent, who wanted to teach kids tangible coding but can't figure out where to start from? If the answer is yes, you'll find MakeCode and CODAL a much more accessible way to break into the world of electronics. MakeCode by Microsoft, is a web app in which you can write code for micro controllers in a high level language, either block-based Blocky or TypeScript, while CODAL (Component-Oriented Device Abstraction Layer) by Lancaster University is an optimized C++ runtime which supports higher-level languages and contains drivers for devices. Initially they were just for the BBC micro:bit but other targets include Arduino Uno or BrainPad. MakeCode offers two conveniences for writing code for electronics.First, it does not require the user to make any installation whatsoever, the likes of compilation toolchains or device drivers;you just need a web browser as everything runs inside the browser, writing code or even compiling C++ binaries! Second, you can program in the Blocky editor for visual block-based programming or Monaco, the code editor powering VS Code, and TypeScript. Blocky makes it easy for pupils and kids to get started, while Monaco caters for more advanced users offering text-based programming in a variant of TypeScript called STS or Static TypeScript, which: "extends TypeScript with a type constructor for concrete types, allowing the programmer to choose between untyped, optionally-typed, and concretely typed code". Going about it typically adheres to the following workflow:
So what do MakeCode and CODAL achieve this way? In yet another lowering of the entry barrier, there is no installation required and, of course, there's the use of high-level languages to write programs for the embedded devices, a territory occupied almost exclusively by low-level languages close to the hardware such C and C++. The problem from the beginning was to figure out a way of removing C/C++'s steep learning curve, but at the same time keep both the functionality and optimizations resulting from its use. By compiling TypeScript to C++ and linking it against CODAL, the optimized and efficient runtime capable of running on devices with a memory footprint as low as 2 to 32 Kb, is a feat by itself. Sure,there's other compilers that compile higher-level languages such as JavaScript, Java, and Python to machine code, but they require the mediation of a VM such as MicroPython, CircuitPython, and Espruino. These VMs are neither performant, nor memory efficient. The benchmarks reinforce this view, by demonstrating that binaries compiled by MakeCode and linked with CODAL outperform the other approaches. So, aspiring electronics adventurers, little or big, give MakeCode and CODAL a try. It's easy to setup and takes care of a lot of boilerplate to allow you to focus on just the one thing you should be focusing on - coding. More InformationMakeCode
Related Articles Hour of Code 2017 Introduces App Lab Pythonroom Brings Coding to the Classroom MakeCode for Lego Mindstorms Launched Micro:bit Commando Jump Using MakeCode The BBC Micro:bit Is An Mbed Device In C/C++
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
Last Updated ( Monday, 01 October 2018 ) |