home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
HTPC Projects
Hardware
Ambient Lighting System
[DIY] User Showcases
[DIY] AtmoOrb - A Hue like mood lamp based on Particle Photon with NeoPixel - *Tutorial added*
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Rick164" data-source="post: 1197914" data-attributes="member: 17766"><p>Not sure with Python tbh but the protocol is fairly straightforward, made a standalone client in ASPX (for web interface) recently with a couple of lines and basically comes down to this:</p><p></p><p>- Create UDP socket and join the multicast group (239.15.18.2)</p><p>- Create a byte array containing your colors and commands, send over previously created UDP socket (C# example)</p><p></p><p>[CODE]</p><p>// Orb ID we want to send to</p><p>int orbId = 1;</p><p></p><p>// Options parameter: 1 = force off | 2 = use lamp smoothing and validate by Orb ID | 4 = validate by Orb ID </p><p>int commandType = 2;</p><p></p><p>// Needs to match AtmoOrb sketch</p><p>int ledCount = 24;</p><p></p><p>// Byte array we send to Orbs</p><p>byte[] bytes = new byte[5 + ledCount* 3]; </p><p></p><p>// Command identifier: C0FFEE</p><p>bytes[0] = 0xC0;</p><p>bytes[1] = 0xFF;</p><p>bytes[2] = 0xEE;</p><p></p><p>bytes[3] = commandType;</p><p></p><p>// Orb ID</p><p>bytes[4] = byte.Parse(orbId);</p><p></p><p>// RED / GREEN / BLUE</p><p>bytes[5] = red;</p><p>bytes[6] = green;</p><p>bytes[7] = blue; </p><p></p><p>Socket.Send(bytes, bytes.Length, SocketFlags.None);</p><p>[/CODE]</p><p></p><p>- In the Python client you could control it like this with arguments:</p><p></p><p>[code]AtmoOrbClient.py <red> <green> <blue> <OrbIDs>[/code]</p><p></p><p>- Then it will execute previous function.</p><p></p><p>Full C# code here:</p><p></p><p><a href="https://github.com/ambilight-4-mediaportal/AtmoLight/blob/master/AtmoLight.Core/Targets/AtmoOrb/UDPMultiCastLamp.cs" target="_blank">https://github.com/ambilight-4-mediaportal/AtmoLight/blob/master/AtmoLight.Core/Targets/AtmoOrb/UDPMultiCastLamp.cs</a></p><p></p><p>Python example of multicast socket here:</p><p></p><p><a href="http://stackoverflow.com/questions/603852/multicast-in-python" target="_blank">http://stackoverflow.com/questions/603852/multicast-in-python</a></p></blockquote><p></p>
[QUOTE="Rick164, post: 1197914, member: 17766"] Not sure with Python tbh but the protocol is fairly straightforward, made a standalone client in ASPX (for web interface) recently with a couple of lines and basically comes down to this: - Create UDP socket and join the multicast group (239.15.18.2) - Create a byte array containing your colors and commands, send over previously created UDP socket (C# example) [CODE] // Orb ID we want to send to int orbId = 1; // Options parameter: 1 = force off | 2 = use lamp smoothing and validate by Orb ID | 4 = validate by Orb ID int commandType = 2; // Needs to match AtmoOrb sketch int ledCount = 24; // Byte array we send to Orbs byte[] bytes = new byte[5 + ledCount* 3]; // Command identifier: C0FFEE bytes[0] = 0xC0; bytes[1] = 0xFF; bytes[2] = 0xEE; bytes[3] = commandType; // Orb ID bytes[4] = byte.Parse(orbId); // RED / GREEN / BLUE bytes[5] = red; bytes[6] = green; bytes[7] = blue; Socket.Send(bytes, bytes.Length, SocketFlags.None); [/CODE] - In the Python client you could control it like this with arguments: [code]AtmoOrbClient.py <red> <green> <blue> <OrbIDs>[/code] - Then it will execute previous function. Full C# code here: [URL]https://github.com/ambilight-4-mediaportal/AtmoLight/blob/master/AtmoLight.Core/Targets/AtmoOrb/UDPMultiCastLamp.cs[/URL] Python example of multicast socket here: [URL]http://stackoverflow.com/questions/603852/multicast-in-python[/URL] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
HTPC Projects
Hardware
Ambient Lighting System
[DIY] User Showcases
[DIY] AtmoOrb - A Hue like mood lamp based on Particle Photon with NeoPixel - *Tutorial added*
Contact us
RSS
Top
Bottom