from microbit import *
while True:
potentiometer_value = pin0.read_analog()
display_value = int(potentiometer_value / 1024 * 9)
if display_value == 0:
display.clear()
else:
for x in range(5):
for y in range(5):
if y <= display_value:
display.set_pixel(x, y, 9)
else:
display.set_pixel(x, y, 0)
sleep(100)
Copyright ⓒ TECH79 All right reserved