SNAP! running micro:bit running microBlocks (subset of blocks)

microBit-n-microBlocksInSNAP

(Shared via SNAP Cloud)

Playing around in all three environments prompted me to write this conglomeration.
It is not as full-featured as any of the three, but still may provide an intro to those who have not dealt with microBlocks or micro:bit before.

It comes with two preset projects and an open third one. Working on a 3rd one to demo UART byte transfer.

microBlocks blocks are dispersed among the SNAP categories as custom blocks marked with the robot pic.

Three coding area sprites are for writing code for the three project options. But really it does not matter where that code is.

micro:bit is always operational, even without the battery connected; to make things easy.

Projects turn the battery on and off.

Some extra actions out of the ordinary:

  • clicking the micro:bit board will make the display pattern reversed.
  • clicking the individual LEDs will toggle them on / off.
  • color blocks above the micro:bit are for color change on the board.
  • clicking the battery will turn it on / off.

microBlocks blocks included:
image

Control blocks for the logic utilize the SNAP! blocks, as they are totally suitable for the task.

PROJECTS:

  1. An electric fan driven by an adjustable pot:
    Preprogrammed button A will turn the fan at selected POT setting.
    Button B will stop the fan.
    Other combos are up to the user.
  2. A DC motor driving a wheel using KEYES Motor Driver Board:
    Preprogrammed button A will turn the motor counter-clock wise.
    Button B will turn the wheel clock wise.
    Other combos are up to the user.
  3. OPEN third project:
    Planning on using it for an UART demo transferring bytes between pins.

PROGRAMMING Details:

Some SNAP! techniques that were used for the GUI are worth mentioning:

  • Clickable MENU created by using PEN write, costume create.
  • Display of PWM and Voltages using position controlled variable reporters.
  • Use of INHERITANCE to drive Voltage / PWM values from source to PINs to and points.
  • Implementation of POT details adhering to OHM’s Law.
  • Adjustable display of float values with n decimal point positions.

Thanks to @jens, this runs very nicely in the new version.

Enjoy.