Files
go1_pro_sdk/examples/example_highlevel_dance.py

39 lines
807 B
Python

#!/usr/bin/env python3
"""高层表演: 跳舞 1 + 头灯炫彩."""
import sys
import time
from go1_pro_sdk import Go1, LED
def main():
print('🐕 高层示例: 跳舞 + 头灯')
with Go1() as dog:
# 头灯橙黄
dog.set_led(LED(255, 128, 0))
print('stand_up...')
dog.stand_up()
time.sleep(3)
print('dance_1!')
dog.dance_1()
# 跳舞期间循环换色
colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0), (255, 0, 255)]
for r, g, b in colors:
dog.set_led(LED(r, g, b))
time.sleep(2)
print('stand_down...')
dog.stand_down()
time.sleep(3)
dog.set_led(LED(0, 0, 0))
print('✅ 结束')
if __name__ == '__main__':
sys.exit(main() or 0)