Toggle Navigation
Hatchery
Eggs
Webcam Cold/Warm Frontlight
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import rgb import buttons, defines import time rgb.clear() green = 255 blue = 255 rgb.background ((255, green, blue)) rgb.framerate(5) currentbrightness = rgb.getbrightness() buttonleft = 0 buttonright = 0 buttonup = 0 buttondown = 0 buttona = 0 def brightnessdown(button_is_down): if button_is_down: global buttonleft buttonleft = 1 pass buttons.register(defines.BTN_LEFT, brightnessdown) def brightnessup(button_is_down): if button_is_down: global buttonright buttonright = 1 pass buttons.register(defines.BTN_RIGHT, brightnessup) def colorcool(button_is_down): if button_is_down: global buttonup buttonup = 1 pass buttons.register(defines.BTN_UP, colorcool) def colorwarm(button_is_down): if button_is_down: global buttondown buttondown = 1 pass buttons.register(defines.BTN_DOWN, colorwarm) def colorswitch(button_is_down): if button_is_down: global buttona buttona = 1 pass buttons.register(defines.BTN_A, colorswitch) while True: time.sleep(0.05) if green > 255 : green = 255 print(green) elif blue > 255 : blue = 255 print(blue) elif buttonleft == 1: rgb.setbrightness(rgb.getbrightness () - 2) buttonleft = 0 elif buttonright == 1: rgb.setbrightness(rgb.getbrightness() + 2) buttonright = 0 elif buttonup: green += 3 blue += 9 if green > 255: green = 255 if blue > 255: blue = 255 rgb.background((255, green, blue)) buttonup = 0 elif buttondown: green -= 3 blue -= 9 if green < 195: green = 195 if blue < 75: blue = 75 rgb.background((255, green, blue)) buttondown = 0 elif buttona: if green < 255 and blue < 255: green = 255 blue = 255 elif green >= 255 and blue >= 255: green = 195 blue = 75 rgb.background((255, green, blue)) buttona = 0