Skip to content

Instantly share code, notes, and snippets.

@fourdollars
Created November 13, 2015 02:41
Show Gist options
  • Save fourdollars/e99c4e03c7dab0110ae7 to your computer and use it in GitHub Desktop.
Save fourdollars/e99c4e03c7dab0110ae7 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python3
def find_duplicate(vbt_min, pwm_max):
prev = -1
pwm_min = round(vbt_min * pwm_max / 255)
print("sysfs : PWM")
print("-----------")
for i in range(pwm_max + 1):
pwm = round(i * (pwm_max - pwm_min) / pwm_max + pwm_min)
if prev == pwm:
print(" %3d -> %3d" % (i - 1, pwm))
print(" %3d -> %3d" % (i, pwm))
prev = pwm
if __name__ == '__main__':
find_duplicate(10, 937)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment