Instructions
Table Of Contents
PROGRAM 4. MU PLOTTER
This final program is only available for MicroPython using Mu because it uses Mu's
Plotter facility to plot values sent out from the micro:bit to your computer over USB.
Load the program onto your micro:bit (called mu_plotter.py) and then click on the
Plotter button in the tool bar. Now when you move the slider about you will see the
values change in the plot.
Here's the code:
from microbit import *
import time
while True:
data = (pin2.read_analog(),)
print(data)
time.sleep(0.05)
The data has to be sent as a Python tuple, even though it only has one value.
That's why there are extra () and a comma in the line highlighted above.
Page 11