from microbit import *
from mb_pins import *

#external power is required!
def servo(ang):
  pin1.set_analog_period(20)
  min=.6*1023/20
  max=2.5*1023/21
  range=max-min
  duty=int(min+(range*ang/180))
  pin1.write_analog(duty)

def lock():
  servo(20)
def unlock():
  #external power is required!
  servo(150)
  
  
