Last active
November 28, 2025 15:27
-
-
Save senyai/9e1bd6a98616606c892c628db155de3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # FOR HY-G60 60W LED Moving Head with Prism | |
| # use with https://github.com/maximecb/pyopendmx | |
| import time | |
| from dmx import * | |
| class LEDSPOT(DMXDevice): | |
| def __init__(self, name, chan_no): | |
| super().__init__(name, chan_no, num_chans=12) | |
| self.yaw_deg = 0 | |
| self.pitch_deg = 0.5 # 90deg | |
| self.color_wheel = 0 | |
| self.gobo_wheel = 0 | |
| self.strobe = 0 | |
| self.light = 0 | |
| self.speed = 0 | |
| self.prism = 0 | |
| self.speed_and_sound = 0 | |
| def update(self, dmx): | |
| assert 0.0 <= self.yaw_deg <= 540.0 | |
| assert 0.0 <= self.pitch_deg <= 180.0 | |
| yaw, yaw_fine = divmod(round(self.yaw_deg / 540.0 * 0xffff), 256) | |
| pitch, pitch_fine = divmod(round((self.pitch_deg / 180.0) * 0xffff), 256) | |
| dmx.set_int(self.chan_no, 1, yaw) | |
| dmx.set_int(self.chan_no, 2, yaw_fine) | |
| dmx.set_int(self.chan_no, 3, pitch) | |
| dmx.set_int(self.chan_no, 4, pitch_fine) | |
| dmx.set_int(self.chan_no, 5, self.color_wheel) | |
| dmx.set_int(self.chan_no, 6, self.gobo_wheel) | |
| dmx.set_int(self.chan_no, 7, self.strobe) | |
| dmx.set_int(self.chan_no, 8, self.light) | |
| dmx.set_int(self.chan_no, 9, self.speed) | |
| dmx.set_int(self.chan_no, 10, self.prism) | |
| dmx.set_int(self.chan_no, 11, self.speed_and_sound) | |
| dmx = DMXUniverse(url='ftdi://ftdi:232:A50285BI/1') | |
| uv = LEDSPOT(name="uv", chan_no=1) | |
| dmx.add_device(uv) | |
| dmx.start_dmx_thread() | |
| yaw = 0.0 | |
| while True: | |
| yaw += 5.0 | |
| uv.yaw_deg = yaw % 540 | |
| time.sleep(4.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment