def analogRead(adc_pin):
  global _ADC_INITIALIZED      
  if not _ADC_INITIALIZED:
    cape_manager.load(ADC_ENABLE_DTS_OVERLAY, auto_unload=False)
    # Don't unload the overlay on exit for now because it can
    # cause kernel panic.
    bbio.delay(100)
    _ADC_INITIALIZED = True
  if adc_pin in ADC: 
    adc_pin = ADC[adc_pin]
    adc_file = glob.glob(adc_pin[0])
    if len(adc_file) == 0:
      overlay = adc_pin[1]
      # Overlay not loaded yet
      cape_manager.load(overlay, auto_unload=False)
    adc_file = glob.glob(adc_pin[0])
  else:
    adc_file = glob.glob(adc_pin)
  if len(adc_file) == 0:
    raise Exception('*Could not load overlay for adc_pin: %s' % adc_pin)
  adc_file = adc_file[0]
  # Occasionally the kernel will be writing to the file when you try 
  # to read it, to avoid IOError try up to 5 times:
  for i in range(5):
    try:
      with open(adc_file, 'rb') as f: 
        val = f.read()
      return int(val)
    except IOError:
      continue
  raise Exception('*Could not open AIN file: %s' % adc_file)
Cleans up the backup_link_path directory by deleting files older than 24 hours
dataset/ETHPy150Open graycatlabs/PyBBIO/bbio/platform/beaglebone/adc.py/analogRead--crossover with--dataset/ETHPy150Open frappe/frappe/frappe/utils/backups.py/delete_temp_backups