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
joystick_color_wheel.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录