treaki Geschrieben May 18, 2012 at 05:15 Geschrieben May 18, 2012 at 05:15 Hi, gibt es irgendwo die quelltexte von dem was im Introducing video gezeigt wurde?? Ich habe mir jetzt den Lautstärkeregla mit dem Linear Poti schon nachprogrammiert währe allerdings sehr an dem code des "Art" Projektes mit dem DistanceIR interessiert. Gruß import com.tinkerforge.BrickletLinearPoti; import com.tinkerforge.IPConnection; public class ExampleCallbackalsamixer { private static final String host = new String("localhost"); private static final int port = 4223; private static final String UID = new String("739"); // Change to your UID // Note: To make the example code cleaner we do not handle exceptions. Exceptions you // might normally want to catch are described in the commnents below public static void main(String args[]) throws Exception { // Create connection to brickd IPConnection ipcon = new IPConnection(host, port); // Can throw IOException BrickletLinearPoti poti = new BrickletLinearPoti(UID); // Create device object // Add device to ip connection ipcon.addDevice(poti); // Can throw IPConnection.TimeoutException // Don't use device before it is added to a connection // Set Period for position callback to 0.05s (50ms) // Note: The position callback is only called every second if the // position has changed since the last call! poti.setPositionCallbackPeriod(10); // Add and implement position listener (called if position changes) poti.addListener(new BrickletLinearPoti.PositionListener() { public void position(int position) { System.out.println("Position: " + position); //Runtime rt = Runtime.getRuntime(); //rt.exec("amixer sset Master " + position + "%"); //rt.exec("mkdir Test"); { try { Runtime rt = Runtime.getRuntime(); rt.exec("amixer sset Master " + position + "%"); } catch(Exception e) { System.out.println("Exception fehler beim setzen der lautstärke mit alsa"); } } } }); System.out.println("Press ctrl+c to exit"); ipcon.joinThread(); } } Zitieren
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.