Created
January 20, 2016 18:12
-
-
Save phoenixperry/8a5f4c5b831ad36129c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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