Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

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();
}
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.