Files
clover/builder/assets/examples/leds.py
Oleg Kalachev 6879723771 image: add some examples (#222)
* image: add some examples

* Rename 'fligth' node to 'leds'

* image: copy examples to /home/pi/examples

* examples: add information links

Co-authored-by: Alamoris <gonzalez1139@gmail.com>
2020-03-12 20:20:27 +03:00

26 lines
679 B
Python

# Information: https://clever.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