Solenoid Engine – Microbit – Micro Python – Simple


# Solenoid Engine Simple Script - Flat out Speed
from microbit import *

while True:
    # if pin2.read_analog()<400: for V1 engines
    if pin2.read_analog()>600:
        pin1.write_digital(1)
        display.show(Image.HAPPY)
    else:
        display.show(Image.SAD)
        pin1.write_digital(0)