Skip to content

Instantly share code, notes, and snippets.

@ramithuh
Created July 14, 2015 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramithuh/22eff24941e2920465f3 to your computer and use it in GitHub Desktop.
Save ramithuh/22eff24941e2920465f3 to your computer and use it in GitHub Desktop.
execute this sketch
import com.leapmotion.leap.*; //leap motion library
import processing.serial.*; //serial communication library
Controller leap; //define a controller
Serial port; //define a port
void setup(){
size(250,250); //sketch size
leap = new Controller(); // initialize the controller
port = new Serial(this, Serial.list()[2], 115200);//initialize the port in my case its [2]
}
void draw(){
FingerList fingers = leap.frame().fingers(); //finger list to get the fingers count
int count = fingers.count(); // integer holds the count of fingers
background(0); // box background color
fill(255); // text color
textSize(height/2); // text size
text(count, 90, 160); // text value and position on the box
port.write(count+"\r"); // port sends the integer to arduino*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment