Open currymuetze opened 9 years ago
Have you tried increasing the timeout of the "(server.availableCheck(2))" ? If it is too low, the messages will be fragmented.
Hi, i got it working. However, suddenly my wifly board doesnt work anymore. I did no changes with my wifi, with sketch or anything else. It seems like i do not get my board connected with the internet: While connected to my board with uploaded sketch the LEDs act as follows:
Any idea what could have happened? I am still able to create a connection though serial monitor (CMD, => join)
I am using the library in combinatino with the WiflyHQ library. Control device: iPhone5 with TouchOSC. uC: ArduinoMega with Wifly, directly connected to RX,TX,3.3v,GND Sending messages from iPhone to Arduino just will be interpreted once in a while, it is very unstable. So sending an OSC signal to turn on or off LED needs about 5-10 trials. My testcode:
//++++++++++++++++++++++++++++++++++++++++WIFLY&OSC++++++++++++++++++++++++++++++++++++
include
include
char* ssid = ""; char pass = ""; char IPwifly = "192.168.192.200"; //IP Wifly Module int Portwifly = 8000; //Touchosc: Outgoing char* IPhost = "192.168.192.7"; //IP iPhone int Porthost = 9000; //Touchosc: Incoming WiFly WIFI; OSCServer server(&WIFI); // receive OSCClient client(&WIFI); // send OSCMessage global_mes;
void setup() { Serial1.begin(115200); Serial.begin(115200); WIFI.setupForUDP(&Serial1,115200,true,ssid,pass,"WiFly",IPwifly,Portwifly,IPhost,Porthost,true);
// WIFI.printStatusInfo();
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
//++++++++++++++++++++++++++++++++++++++++++++++++ReceiveFunctions++++++++++++++++++++++++++++++++++++++++++++++++
server.addCallback("/1/1",&switchPage);
}
void loop() {
if(server.availableCheck(2)>0){
Serial.println("ok");
}
}
void switchPage(OSCMessage *_mes) {
if (_mes->getArgFloat(0)==0) digitalWrite(13,LOW);
else if (_mes->getArgFloat(0)==1) digitalWrite(13,HIGH);
}