Code to Note
Let’s take a look at the code blocks in this experiment.
If you are having a hard time viewing this code, click on the image above to get a better look!
Adding an External Package
In MakeCode you can write external pieces of code that allows you to create and use custom blocks
for specific applications and/or components that you could use with the micro:bit. We wrote a simple
package for the TMP36 temperature sensor to cut out a lot of complicated math for you to do.
To add a package to your MakeCode editor first click on
Advanced
and then
Add Packages…
.
This will bring up a search box. Feel free to search for different packages to play with, but for this
specific example you need to search for a specific package. Please copy the link below and paste it
into your search box.
COPY
CODEhttps:
//github.com/sparkfun/pxt
‐
tmp36
This should bring up the TMP36 package that we wrote. To add the package to your sketch just click
on the package once it appears in the search output!