Skip to content

Instantly share code, notes, and snippets.

@phoenixperry
Created January 20, 2016 18:12
Show Gist options
  • Save phoenixperry/8a5f4c5b831ad36129c9 to your computer and use it in GitHub Desktop.
Save phoenixperry/8a5f4c5b831ad36129c9 to your computer and use it in GitHub Desktop.
import processing.serial.*;
import netP5.*;
import oscP5.*;
import processing.net.*;
OscP5 oscP5;
int receiveAtPort;
int sendToPort;
String host;
String oscP5event;
Server myServer;
Serial myPort;
byte zero = 0;
Serial myPort;
int serialVal;
void setup(){
frameRate(25);
background(0);
size(320,440);
initOsc();
myServer = new Server(this,port);
}
void initOsc() {
receiveAtPort =8000;
sendToPort = 8080;
// sendToPort = 1250;
host = "127.0.0.1";
oscP5event = "oscEvent";
oscP5 = new OscP5(
this,
host,
sendToPort,
receiveAtPort,
oscP5event
);
}
void oscEvent(OscIn oscIn) {
println("received ..."+ oscIn);
//save the Osc data from wekinator here to a global variable
//play some sound
}
void sendOscData() {
//send OSC data to wekinator
}
void readSerial() {
while (myPort.available() > 0) { //hey while there's data at the port
myString = myPort.readStringUntil(lf); //read it until you hit the end of the line.
//and save it into the myString variable
if (myString != null) { //if we did that successfully
//print(myString); // Prints String
//assign serial data to global variable
}
sendOscData();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment