Advertisement
Guest User

Nanoleaf Aurora (Java) Complicated Example

a guest
Jan 18th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import io.github.rowak.Aurora;
  2. import io.github.rowak.Panel;
  3.  
  4. public class ComplicatedPanelTest
  5. {
  6.     public static void main(String[] args) throws Exception
  7.     {
  8.         // Create a new aurora object to interact with the physical aurora
  9.         Aurora aurora = new Aurora("YOUR_AURORA_IP", 16021,
  10.                 "v1", "YOUR_API_KEY");
  11.  
  12.         // Get an array of all the panels
  13.         Panel[] panels = aurora.panelLayout().getPanels();
  14.        
  15.         // Get the panel id of the first panel in the array
  16.         int id = panels[0].getId();
  17.        
  18.         // Create a static effect that changes the color of the panel to red
  19.         String json = "{"
  20.                       + "\"command\":\"display\","
  21.                       + "\"animType\":\"static\","
  22.                       + "\"animData\":\"1 " + id + " 1 255 0 0 0 20\","
  23.                       + "\"loop\":false"
  24.                       + "}";
  25.        
  26.         // Send the effect to the aurora (using the "display" command)
  27.         aurora.effects().writeEffect(json);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement