Files
clover/builder/assets/examples/leds.py
2020-05-01 00:39:38 +03:00

26 lines
679 B
Python

# Information: https://clover.coex.tech/en/leds.html
import rospy
from clover.srv import SetLEDEffect
rospy.init_node('leds')
set_effect = rospy.ServiceProxy('led/set_effect', SetLEDEffect) # define proxy to ROS-service
set_effect(r=255, g=0, b=0) # fill strip with red color
rospy.sleep(2)
set_effect(r=0, g=100, b=0) # fill strip with green color
rospy.sleep(2)
set_effect(effect='fade', r=0, g=0, b=255) # fade to blue color
rospy.sleep(2)
set_effect(effect='flash', r=255, g=0, b=0) # flash twice with red color
rospy.sleep(5)
set_effect(effect='blink', r=255, g=255, b=255) # blink with white color
rospy.sleep(5)
set_effect(effect='rainbow') # show rainbow