Instructions

Code for a Simple Bar-Chart (MakeCode)
The link for the MakeCode version of this project is here:
https://makecode.microbit.org/_R1D337cbTPe1
How it Works
Pin P0 of the micro:bit is connected to the Charge% pin on the Solar Store. This
connection provides a voltage in the range of 0V to 3V that represents the stored
charge in the super-capacitor on the Solar Store. The micro:bit analog_read_pin
command reads this voltage, and turns it into a number in the range of 0 to 1023.
As the voltage on the pin increases, the number increases.
MakeCode fortunately has a really easy to use bar-chart block built-in to the
language, that takes that value and draws a different number of dots on the screen.
Because this is a general purpose block, you also provide it with the maximum
possible value (in this case 1023) so that it can correctly choose how many dots to
display.
Pressing button B puts a 3V voltage on pin P2, which is connected to the Enable
pin of the Solar Store, and this will route power to the right hand 3V pin on the Solar
Store that then powers your fan. Pressing button A removes that voltage on pin P2
(setting it to 0V) which disables the output and the fan stops.
Note: Make sure that you also connect the 0V and 3V pins at the top of the Solar
Store to the 0V and 3V pins of the micro:bit – these are needed to power a small
amplifier chip that measures the Solar Store charge and presents it as a voltage on
the Charge% pin. If there is not enough stored charge in the Solar Store, the fan will
not run – just wait a bit longer for it to charge.
Page 15