Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Processing example: Count connected controllers (issue 30)

  • Loading branch information...
commit c7033316c0644fe4960625343280bdfe0bd18cb0 1 parent 5c52d44
@thp authored
View
15 examples/processing/multiple_controllers_tracker/multiple_controllers_tracker.pde
@@ -2,18 +2,25 @@
// Import the PS Move API Package
import io.thp.psmove.*;
+// Tracker and controller handles
PSMoveTracker tracker;
+PSMove [] controllers; // Define an array of controllers
+// Variables for storing the camera image
PImage img;
byte [] pixels;
-int connectedControllers = 2; // Number of connected Move controllers (a more generic solution would be to use count_connected() in the setup)
-PSMove[] controllers; // Define an array of controllers
-
void setup() {
size(640, 480);
- controllers = new PSMove[connectedControllers];
+ int connected = psmoveapi.count_connected();
+
+ // This is only fun if we actually have controllers
+ if (connected == 0) {
+ print("WARNING: No controllers connected.");
+ }
+
+ controllers = new PSMove[connected];
// Fill the array with controllers and light them up in white
for (int i = 0; i<controllers.length; i++) {

1 comment on commit c703331

@SableRaf

Great!

Please sign in to comment.
Something went wrong with that request. Please try again.