|
楼主 |
发表于 2020-6-6 20:31
|
显示全部楼层
# MicroPython动手做(28)——物联网之Yeelight
#测试HSV颜色模型的hue 色调(饱和度设为100)
[mw_shl_code=arduino,true]# MicroPython动手做(28)——物联网之Yeelight
#测试HSV颜色模型的hue 色调(饱和度设为100)
from mpython import *
import network
import music
from yeelight import *
import time
my_wifi = wifi()
my_wifi.connectWiFi("zh", "zy1567")
music.play('G5:1')
oled.fill(0)
oled.DispChar("测试HSV色调", 35, 18, 1)
oled.DispChar("0-359", 55, 29, 1)
oled.show()
bulb = Bulb(discover_bulbs()[0]["ip"])
time.sleep_ms(500)
bulb.turn_on()
time.sleep_ms(500)
bulb.set_brightness(100)
time.sleep_ms(500)
bulb.set_rgb(51, 0, 0)
rgb[1] = (int(0), int(102), int(0))
rgb.write()
time.sleep_ms(1)
while True:
for i in range(0, 360, 22):
time.sleep_ms(500)
bulb.set_hsv(i, 100)[/mw_shl_code]
|
|