From 68d6c61ca507d98f79603f19a21f70b2dd5530e7 Mon Sep 17 00:00:00 2001 From: jancoow Date: Sun, 17 May 2015 12:16:41 +0200 Subject: [PATCH] Add some comments --- src/control/Ledstrip.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/control/Ledstrip.java b/src/control/Ledstrip.java index 1e07e7f..fb4eddc 100644 --- a/src/control/Ledstrip.java +++ b/src/control/Ledstrip.java @@ -10,10 +10,10 @@ public class Ledstrip { private BufferedReader inp; private BufferedWriter out; private Process p; + public Ledstrip(){ - String cmd = "sudo python led.py"; try { - p = Runtime.getRuntime().exec(cmd); + p = Runtime.getRuntime().exec("sudo python led.py"); inp = new BufferedReader( new InputStreamReader(p.getInputStream()) ); out = new BufferedWriter( new OutputStreamWriter(p.getOutputStream()) ); @@ -39,6 +39,15 @@ public class Ledstrip { p.destroy(); } + + /** + * Set the color of a specific led + * @param Pixel number of the led + * @param Red value + * @param Green value + * @param Blue value + * Remember: Button leds are GRB, normal ledstrip is RGB + */ public void setLed(int led, int r, int g, int b) { try { out.write( "1|" + led + "|" + r + "|" + g + "|" + b + "\n" ); @@ -49,6 +58,9 @@ public class Ledstrip { } } + /** + * Shows the (new) colors + */ public void show(){ try { out.write( "0\n" );