need help with test sketch

first of all, im new to micro controllers, im building a firework controller that will fire via my iphone, ive picked out the app on the phone and im using iosc. ive tried to use a iphone iosc test sketch to control some leds and im pretty sure that its communicating because i open the serial monitor and the messages get sent and the rx light on the ethernet board lights up everytime i hit a button, if someone out there has a lil extra time it would be awesome if u could help me out with this. if there is someone that could help this is the code ive been trying
if it makes any difference im using arduino software version 21
if someone can message me and actually help out i wouldnt mind paying them a bit for the help!!

iOSC setting
OSCMessage type value on off
button1 /ard/ledyel int 1 0 :info-AlternateMode "ON" =toggle sw
button2 /ard/ledgrn int 1 0
button3 /ard/ledred int 1 0
slider1 /ard/ledpwm int min:0 max:255

host setting IP address 192.168.1.99 , port 10000

*/

#include "Ethernet.h"
#include "OSCClass.h"
#include "SPI.h"

#define LED_RED 2
#define LED_GRN 3
#define LED_YEL 4
#define LED_PWM 6

OSCMessage recMes;

OSCClass osc(&recMes);

byte serverMac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x3F, 0xF0 };
byte serverIp[] = { 192, 168, 2, 9 };
int serverPort = 10000;

byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };

char *topAddress="/ard";
char *subAddress[4]={ "/ledred" , "/ledgrn" , "/ledyel" , "/ledpwm"};

void setup() {

//for message logging

Serial.begin(19200);

// Ethernet.begin(serverMac ,serverIp);
Ethernet.begin(serverMac ,serverIp ,gateway ,subnet);

//setting osc recieve server
osc.begin(serverPort);

pinMode(LED_RED, OUTPUT);
pinMode(LED_GRN, OUTPUT);
pinMode(LED_YEL, OUTPUT);
pinMode(LED_PWM, OUTPUT);

digitalWrite(LED_RED, LOW); //LED OFF
digitalWrite(LED_GRN, LOW); //LED OFF
digitalWrite(LED_YEL, LOW); //LED OFF
digitalWrite(LED_PWM, LOW); //LED OFF

//osc message buffer clear
osc.flush();

}

void loop() {

//osc arrive check
if ( osc.available() ) {

logMessage(&recMes);

//toplevel address matching
if( !strcmp( recMes.getAddress(0) , topAddress ) ){

//second level address matching
if( !strcmp( recMes.getAddress(1) , subAddress[0] ) ){

red();

}

else if( !strcmp( recMes.getAddress(1) , subAddress[1] ) ){

green();

}
else if( !strcmp( recMes.getAddress(1) , subAddress[2] ) ){

yellow();

}

else if( !strcmp( recMes.getAddress(1) , subAddress[3] ) ){

pwm();

}

}

}

}

void red(){

if(recMes.getArgInt(0) == 1){
digitalWrite(LED_RED, HIGH); //LED_ON
}
else{
digitalWrite(LED_RED, LOW); //LED OFF
}

}

void green(){

if(recMes.getArgInt(0) == 1){
digitalWrite(LED_GRN, HIGH); //LED_ON
}
else{
digitalWrite(LED_GRN, LOW); //LED OFF
}

}

void yellow(){

if(recMes.getArgInt(0) == 1){
digitalWrite(LED_YEL, HIGH); //LED_ON
}
else{
digitalWrite(LED_YEL, LOW); //LED OFF
}

}

void pwm(){
byte value=(byte)recMes.getArgInt(0);
analogWrite(LED_PWM, 255-value);

}

// ********* utility ***********************************

void logMessage(OSCMessage *mes){

uint8_t *ip=mes->getIp();

//disp ip & port
Serial.print("from IP:");
Serial.print(ip[0],DEC);
Serial.print(".");
Serial.print(ip[1],DEC);
Serial.print(".");
Serial.print(ip[2],DEC);
Serial.print(".");
Serial.print(ip[3],DEC);
Serial.print(" port:");
Serial.print(mes->getPort(),DEC);
Serial.print(" ");

//disp adr
for(int i = 0 ; i < mes->getAddressNum() ; i++){

Serial.print(mes->getAddress(i));

}

//disp type tags
Serial.print(" ,");
for(int i = 0 ; i < mes->getArgNum() ; i++){

Serial.print(mes->getTypeTag(i));

}
Serial.print(" ");

//disp args
for(int i = 0 ; i < mes->getArgNum() ; i++){

switch( mes->getTypeTag(i) ){

case 'i': {

Serial.print( mes->getArgInt(i) );
}
break;

case 'f': {

Serial.print( mes->getArgFloat(i) );
}
break;

}

Serial.print(" ");

}

Serial.println("");

}

Since the messages are getting logged on the serial monitor properly the problem must be after that somewhere. Try adding a Serial.println() in each step to check intermediate results. Perhaps the address parts are getting split up differently from what you expect. The code you have looks good to me but I have not used OSC before.

Can you ping your arduino without problem ?

why not using 192.168.1.XXX address for the serverIp variable ?

ok i know this sounds lame but how and where would i put a Serial.printIn()
like i said im very new to programming
the reason i went with the 192.168.2.7 is because i tried 192.168.1.99 and it would not communicate, the rx light would not light up and there was nothing in the serial monitor.

I'd put in a line to make sure the topAddress matches correctly:

         //toplevel address matching
          if( !strcmp( recMes.getAddress(0) , topAddress ) ){
              Serial.println("Top address matched.");

Then put a similar line at the top of each of the red, green, yellow, and pwm functions. That will show you, on the serial monitor, that the Arduino is following the expected code path (or not).

Can you copy and paste the serial monitor output you get when you poke the buttons and sliders? Perhaps someone will notice something in the existing message output that will point to a solution.

/*

iOSC setting
OSCMessage type value on off
button1 /ard/ledyel int 1 0 :info-AlternateMode "ON" =toggle sw
button2 /ard/ledgrn int 1 0
button3 /ard/ledred int 1 0
slider1 /ard/ledpwm int min:0 max:255

host setting IP address 192.168.2.97 , port 10000

*/

#include "Ethernet.h"
#include "OSCClass.h"
#include "SPI.h"

#define LED_RED 2
#define LED_GRN 3
#define LED_YEL 4
#define LED_PWM 6

OSCMessage recMes;

OSCClass osc(&recMes);

byte serverMac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x3F, 0xF0 };
byte serverIp[] = { 192, 168, 2, 97 };
int serverPort = 10000;

byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };

char *topAddress="/ard";
char *subAddress[4]={ "/ledred" , "/ledgrn" , "/ledyel" , "/ledpwm"};

void setup() {

//for message logging

Serial.begin(19200);

// Ethernet.begin(serverMac ,serverIp);
Ethernet.begin(serverMac ,serverIp ,gateway ,subnet);

//setting osc recieve server
osc.begin(serverPort);

pinMode(LED_RED, OUTPUT);
pinMode(LED_GRN, OUTPUT);
pinMode(LED_YEL, OUTPUT);
pinMode(LED_PWM, OUTPUT);

digitalWrite(LED_RED, LOW); //LED OFF
digitalWrite(LED_GRN, LOW); //LED OFF
digitalWrite(LED_YEL, LOW); //LED OFF
digitalWrite(LED_PWM, LOW); //LED OFF

//osc message buffer clear
osc.flush();

}

void loop() {

//osc arrive check
if ( osc.available() ) {

logMessage(&recMes);

//toplevel address matching
if( !strcmp( recMes.getAddress(0) , topAddress ) ){
Serial.println("Top address matched.");

//second level address matching

if( !strcmp( recMes.getAddress(1) , subAddress[0] ) ){
Serial.println("Top address matched.");
red();

}

else if( !strcmp( recMes.getAddress(1) , subAddress[1] ) ){
Serial.println("Top address matched.");
green();

}
else if( !strcmp( recMes.getAddress(1) , subAddress[2] ) ){
Serial.println("Top address matched.");
yellow();

}

else if( !strcmp( recMes.getAddress(1) , subAddress[3] ) ){
Serial.println("Top address matched.");
pwm();

}

}

}

}

void red(){

if(recMes.getArgInt(0) == 1){
if( !strcmp( recMes.getAddress(0) , topAddress ) ){
Serial.println("Top address matched.");
}

digitalWrite(LED_RED, HIGH); //LED_ON
}
else{
digitalWrite(LED_RED, LOW); //LED OFF
}

}

void green(){

if(recMes.getArgInt(0) == 1){
digitalWrite(LED_GRN, HIGH); //LED_ON
}
else{
digitalWrite(LED_GRN, LOW); //LED OFF
}

}

void yellow(){

if(recMes.getArgInt(0) == 1){
digitalWrite(LED_YEL, HIGH); //LED_ON
}
else{
digitalWrite(LED_YEL, LOW); //LED OFF
}

}

void pwm(){

byte value=(byte)recMes.getArgInt(0);
analogWrite(LED_PWM, 255-value);

}

// ********* utility ***********************************

void logMessage(OSCMessage *mes){

uint8_t *ip=mes->getIp();

//disp ip & port
Serial.print("from IP:");
Serial.print(ip[0],DEC);
Serial.print(".");
Serial.print(ip[1],DEC);
Serial.print(".");
Serial.print(ip[2],DEC);
Serial.print(".");
Serial.print(ip[3],DEC);
Serial.print(" port:");
Serial.print(mes->getPort(),DEC);
Serial.print(" ");

//disp adr
for(int i = 0 ; i < mes->getAddressNum() ; i++){

Serial.print(mes->getAddress(i));

}

//disp type tags
Serial.print(" ,");
for(int i = 0 ; i < mes->getArgNum() ; i++){

Serial.print(mes->getTypeTag(i));

}
Serial.print(" ");

//disp args
for(int i = 0 ; i < mes->getArgNum() ; i++){

switch( mes->getTypeTag(i) ){

case 'i': {

Serial.print( mes->getArgInt(i) );
}
break;

case 'f': {

Serial.print( mes->getArgFloat(i) );
}
break;

}

Serial.print(" ");

}

Serial.println("");

}

im not sure but i think in put thoes in right, correct me if im wrong

from IP:192.168.2.2 port:60190 ardledyel ,i 1
from IP:192.168.2.2 port:60190 ardledyel ,i 0
from IP:192.168.2.2 port:55289 ardledgrn ,i 1
from IP:192.168.2.2 port:55289 ardledgrn ,i 0
from IP:192.168.2.2 port:61539 ardledred ,i 1
from IP:192.168.2.2 port:61539 ardledred ,i 0
from IP:192.168.2.2 port:53588 ardledpwn ,i 255
from IP:192.168.2.2 port:53588 ardledpwn ,i 247
from IP:192.168.2.2 port:53588 ardledpwn ,i 236
from IP:192.168.2.2 port:53588 ardledpwn ,i 217
from IP:192.168.2.2 port:53588 ardledpwn ,i 190
from IP:192.168.2.2 port:53588 ardledpwn ,i 158
from IP:192.168.2.2 port:53588 ardledpwn ,i 124
from IP:192.168.2.2 port:53588 ardledpwn ,i 90
from IP:192.168.2.2 port:53588 ardledpwn ,i 61
from IP:192.168.2.2 port:53588 ardledpwn ,i 34
from IP:192.168.2.2 port:53588 ardledpwn ,i 4
from IP:192.168.2.2 port:53588 ardledpwn ,i 0
from IP:192.168.2.2 port:53588 ardledpwn ,i 0
from IP:192.168.2.2 port:53588 ardledpwn ,i 0
from IP:192.168.2.2 port:53588 ardledpwn ,i 10
from IP:192.168.2.2 port:53588 ardledpwn ,i 29
from IP:192.168.2.2 port:53588 ardledpwn ,i 61
from IP:192.168.2.2 port:53588 ardledpwn ,i 102
from IP:192.168.2.2 port:53588 ardledpwn ,i 158
from IP:192.168.2.2 port:53588 ardledpwn ,i 233
from IP:192.168.2.2 port:53588 ardledpwn ,i 255
from IP:192.168.2.2 port:53588 ardledpwn ,i 255
that is what came up in the monitor

Hard to be sure, but it looks like the slashes in your address literals are the problem, i.e. this:

char *topAddress="/ard";
char *subAddress[4]={ "/ledred" , "/ledgrn" , "/ledyel" , "/ledpwm"};

should probably be:

char *topAddress="ard";
char *subAddress[4]={ "ledred" , "ledgrn" , "ledyel" , "ledpwm"};

Also, in those Serial.print statements you added, you have the same string - "Top address matched." for all of them. Each of them will need to be different so you can see where the code went. Doesn't much matter what they are, but a mention of the led colour might be nice.

Looks like you have to change:

  char *topAddress="/ard";
  char *subAddress[4]={ "/ledred" , "/ledgrn" , "/ledyel" , "/ledpwm"};

to

  char *topAddress="ard";
  char *subAddress[4]={ "ledred" , "ledgrn" , "ledyel" , "ledpwm"};

EDIT: Oops... wildbill got there first.

So I found this thread after posting earlier...

I am having the exact same problem as the original poster (in Arduino 22, however) and making the suggested change (removing the "/") has not fixed the unresponsiveness of the LEDs.

The "RX" light on the board suggests that everything is good up until that point.

I'm in a bit of a bind with this, so any suggestions would be greatly appreciated.

Thanks!