micro:climate Kit Experiment Guide
Installing the weather:bit Extension in MakeCode
To make the most out of the weather:bit with the least amount of coding, use the MakeCode extension we wrote for the weather:bit board.
If you have used Arduino before, you probably know about a thing called a library; which is a collection of code that extends the functionality of the core programming language. MakeCode extensions work the same way.
Installing a MakeCode Extension
To install or add a new extension to your MakeCode toolbox (the list of different block groups), click on "Advanced" and then on "Add Extension."
From here you can search for "SparkFun" or "SparkFun weather-bit," and it should show up as a public extension in the list. Go ahead and click on it.
This will add all of the blocks to your toolbox. In general, this is a bit tricky as, depending on how the extension was written, it may either have its own toolbox or just add blocks to the existing ones. Take a look at your toolbox; for the weather:bit you should see...
Great! You have now installed the weather:bit extension and are ready to use the board as well as the components that come in the micro:climate kit. As a side note, for every new MakeCode project that you make, you will have to load extensions over again. Not a big deal, but noteworthy! Now, let's put this extension to good use!
If you receive this message:
Compilation failed, please check your code for errors, you will need to delete any code block that uses the extension. Then you will need head back to Advanced > Add Extension and reinstall the extension. Once you re-add the extension, a window will pop up. Click on the
Remove extension(s) and add weatherbitbutton to reinstall the extension.
Finally, you will need to re-add the code blocks used by the extension in your code before compiling and uploading to your micro:bit.