/****************************************************
 * Adapted from oscP5sendreceive by andreas schlegel
 * example shows how to send and receive osc messages.
 * oscP5 website at http://www.sojamo.de/oscP5
 *
 * -Expects data sent from OSC_send1, sending "/test"
 *  with one integer added to the message (type "i")
 */
import oscP5.*;
import netP5.*;
//-------------- Global Variables defined at top --------------------
int oscValue1; //-- Create integer variable for data in osc Message
OscP5 oscP5;   //-- Create instance of OscP5 software object
 
void setup() {
  size(400,400);
  frameRate(25);
  /* start oscP5, listening for incoming messages at port 8800 */
  oscP5 = new OscP5(this, 8800); //-- Create instance of OscP5 called "oscP5"
}

void draw() { 
    background(oscValue1); 
}

/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
   if(theOscMessage.checkAddrPattern("/test")==true) {
    println("Got it.");
    } else {
    println("Wrong AddrPattern.");  
    }
 oscValue1 = theOscMessage.get(0).intValue(); //-- Get integer, if sent in message
 println("Values received: " + oscValue1);
}
