Created
November 13, 2015 02:41
-
-
Save fourdollars/e99c4e03c7dab0110ae7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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