joystick_color_wheel.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:52-Weeks-of-Pi 作者: grantwinney 项目源码 文件源码
def adjust_angle_for_perspective_of_current_led(angle, led):
    """
    Take the current LED into account, and rotate the coordinate plane 360° to make PWM calculations easier
    :param angle: integer, between 0-359 indicating current angle of joystick position
    :param led: 'R', 'G', 'B', indicating the LED we're interested in
    :return: integer, between 0-359 indicating new angle relative to the current LED under consideration
    """

    led_peak_angle = 90 if led == 'R' else (210 if led == 'B' else 330)
    return ((angle - led_peak_angle) + 360) % 360
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号