Microsoft PXT - Introduction
Microsoft PXT is the newest of the editors. It is made by Microsoft and is a natural step from the basic Block Editor. At frist glance, it looks very similar.
The following is a list of things that you can do with this editor that are not possible in the simpler block editor,
- Write the exact same programs that you wrote in the old Block Editor.
- See lovely icons on each block.
- Change the range of values you get from the accelerometer.
- Disable the LED matrix to free up some GPIO pins.
- Work out the remainder resulting from a division calculation.
- Convert a character code into a character.
- Find the minium or maximum of two values.
- Use the radio.
- Create events based on changes to the state of GPIO pins and specific values being sent.
- Get the time in microseconds for a pulse signal.
- Use the i2c and SPI pins.
- Play a music pitch rather than a note.
- Change whether GPIO pins use pull-up or pull-down resistors.
- Read and write serial messages via USB or GPIO pins.
- Write processes that are completed in the background.
- Create microsecond-length pauses.
- Use bluetooth functions.
- Work with Neopixels.
- Work with text files on the micro:bit.
This is quite a long list and is a massive upgrade on the functionality of the simpler block editor.
The additional features are the biggest boost. They allow you to work with different types of hardware with the block libraries making it relatively simple.
Microseconds are a very small unit of time. You'd be forgiven for thinking that this doesn't bring a lot to the party. Some components require specific signals to be sent within time frames that are this small. Being able to read microsecond pulses allows you to use range finders. Range finders are sensors to measure distance. At the affordable end of the market, you would pulse a trigger pin that sends out an ultrasonic blast. An echo pin is read and, based on the speed of sound, you can work out the distance to the object. Electricity moves pretty quickly. Microseconds are often all you need to wait - rounding everything up to a millisecond can throw off the timing of a program if you do it a lot.
Being able to run code in the background allows you to tie together animation and music. It's a bit more powerful than that though. For matrix displays and seven-segment displays, you need to have constant updating. Only a specific number of LEDs are on at any one time. With sufficiently small delays between the on/off switching, the LEDS look like they are on at the same time.
The additional Math blocks don't seem too impressive and, there is still a lot of stuff missing from here. They are useful however. The minimum and maximum blocks are a neat way to compare two items - much quicker than using an IF block. The remainder function is a nice extra - it is something you often need as a programmer.
The component libraries open up a lot of possibilities for you. Neopixels are bright and shiny things that are easy to connect and control if the code editor has a library of functions for you. There are some nice effects included in the libary. The i2c and SPI protocols are not the easiest things to use but are essential for working with complex components like RTCs.