text: import RPi.GPIO as gpio
  
  head = {}
  
  gpio.setmode(gpio.BCM)
  gpio.setwarnings(False)
  
  def cleanup():
      gpio.cleanup()
  
  # wheels
  def begin_wheels():
      gpio.setup(22, gpio.OUT)
      gpio.setup(23, gpio.OUT)
      gpio.setup(24, gpio.OUT)
      gpio.setup(25, gpio.OUT)
          
  def forward():
      gpio.output(22, True)
      gpio.output(23, False)
      gpio.output(24, True)
      gpio.output(25, False)
          
  def backward():
      gpio.output(22, False)
      gpio.output(23, True)
      gpio.output(24, False)
      gpio.output(25, True)
          
  def turn_left():
      gpio.output(22, False)
      gpio.output(23, True)
      gpio.output(24, True)
      gpio.output(25, False)
          
  def turn_right():
      gpio.output(22, True)
      gpio.output(23, False)
      gpio.output(24, False)
      gpio.output(25, True)
          
  def stop():
      gpio.output(22, False)
      gpio.output(23, False)
      gpio.output(24, False)
      gpio.output(25, False)
  
  # head
  def begin_head():
      gpio.setup(26, gpio.OUT)
      head['p'] = gpio.PWM(26, 50)
      head['p'].start(0)
      head['current_angle'] = 0
          
  def set_angle(angle):
      if angle >= 0 and angle <= 180:
          dutycycle = 3.0 + (float(angle) * 0.05)
          head['p'].ChangeDutyCycle(dutycycle)
          head['current_angle'] = angle
      else:
          raise ValueError('The angle value is not in the range 0~180.')
          
  def set_dutycycle(dutycycle):
      dutycycle = float(dutycycle)
      if dutycycle >= 3.0 and dutycycle <= 12.0:
          head['p'].ChangeDutyCycle(dutycycle)
          head['current_angle'] = (dutycycle - 3.0) * 20
      else:
          raise ValueError('The dutycycle value is not in the range 3.0~12.0.')
          
  def get_angle():
      return head['current_angle']
      
  def home():
      set_angle(90)
  