a boost module for openpool library
C# C++ XSLT Java CSS Processing Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
circuit
data
dependency Started to use raw RXTXlib. Mar 3, 2013
distribution
examples/OpenpoolBoostPocketExample
lib
mbed
osc-module
resources
src.app
src/openpool/pocket
web Fixed .classpath and ran build.xml Feb 23, 2013
.classpath Started to use raw RXTXlib. Mar 3, 2013
.gitignore
.project
LICENSE.txt
README.md
README.txt Updated readme, just a little bit, again. Mar 3, 2013

README.md

openpool-boost-pocket

Copyright (C) 2013 Kazunori Ogasawara and Jun Kato


A boost module for openpool library.

How to use

Extract a zip archive

Extract contents of OpenPoolBoostPocket.zip into Processing library directory. All files should reside in its subdirectory e.g.

C:\Users\hoge\Documents\Processing\libraries\OpenpoolBoostPocket

Prepare proper RXTX library

Default RXTX library in OpenpoolBoostPocket/library directory is for Windows with 64bit Java VM. If you're running Processing in another configuration, e.g. Windows with 32bit Java VM or Mac OS with 64bit Java VM, please download proper RXTX library from its official website and extract files into the directory.

Write code

Select "OpenpoolBoostPocket" from Sketch > Import Library... menu.

import openpool.pocket.*;

OpenpoolBoostPocket obp;

void setup() {
  // Connect to the pocket detector.
  try {
    obp = new OpenpoolBoostPocket(this, "COM4");
    obp.start();
  } catch (Exception e) {
    println("Pocket detector not found.");
  }
}

void draw() {
  if (obp == null) return;

  // When you want to know the total pockets, call
  // getTotalPockets() method.
  int[] totalPockets = obp.getTotalPockets();

  // You might sometimes want to call resetTotal() to reset the
  // total numbers.
  //obp.resetTotal();

  // When you want to know if there's any pocket after the last
  // frame, call getPockets() method.

  int[] pockets = obp.getPockets();
  for (int i = 0; i < pockets.length; i ++) {
    if (pockets[i] > 0) {
      print(pockets[i]);
      print(" balls fell in the pocket no.");
      println(i + 1);
    }
  }
}

License

This work is licensed under GNU GPL, Version 2.0.


http://github.com/openpool/openpool-boost-pocket