Instructions
Table Of Contents
the reading will be 1023. Note that in practice the maximum value will be around
1013 rather than 1024 because of extra circuitry built into the Slider for micro:bit
that protects the micro:bit.
This example will display the reading when button A is pressed. Load it onto your
micro:bit (see the link) and try moving the slider to various positions and then press
button A and see what the reading is.
Click on this link and then Download the program onto your micro:bit:
https://makecode.microbit.org/_5x9RyqRKyTwL
If you are using Python, the following program does the same as the blocks code
above. You can download all the Python example code for this kit at
https://github.com/monkmakes/mb_slider. The program is called analog_reading.py.
from microbit import *
while True:
if button_a.was_pressed():
display.scroll(pin2.read_analog())
For more information on using MicroPython on your micro:bit, see the Section
MicroPython with Mu, later in these instructions.
Here are some more programs for you to test out the slider.
Page 7