#include <SPI.h>
#include <Ethernet.h>

#include <ArdOSC.h>

byte myMac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte myIp[]  = { 10, 0, 1, 32 };
int  serverPort  = 10000;

int ledPin1 =  9;
int ledPin2 =  8;

int flag=0;

OSCServer server;
OSCClient client;

void setup(){ 
  
 Serial.begin(19200);
 
 Ethernet.begin(myMac ,myIp); 
 server.begin(serverPort);
 
 server.addCallback("/B1",&func1);
 server.addCallback("/RedSlider",&func2);
 
 pinMode(ledPin1, OUTPUT);  
 pinMode(ledPin2, OUTPUT); 
}

  
void loop(){
  
  if(server.aviableCheck()>0){

  }
  
}

void func1 (OSCMessage *_mes){
 
 
 digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(50);
}

void func2 (OSCMessage *_mes){
 
 float OSCFloat=_mes->getArgFloat(0);
 
 digitalWrite(ledPin2, OSCFloat);
 Serial.print("Data: ");
 Serial.println (OSCFloat);
 delay(50);
}
