Posts

Showing posts from October, 2020

Building an extension for MakeCode for micro:bits

Image
  I have built a couple of extensions for MakeCode, but it was not without pain. The trouble is that the writers of the documentation, such as Building your own extension , don't know my limitations (I'm not a professional coder, for one). So I'll try and show you one way to do the job - there are other ways which may suit someone who is familiar with Node.js and so on, but I'm more at home using a browser. A browser and a text editor are all you will need! I'll use my Bitwise Logic extension as an example. The functions operate on each bit of a number and are very useful when we are interfacing a micro:bit to other electronic devices. The first thing to do is to work out which blocks you want to create. I'll start with a really simple block - it provides the bitwise NOT function . In JavaScript that is represented by the ~ operator. So to invert each bits of the variable called a you would write: ~a In our blocks view of the world we want  to make a block li