Go Down

Topic: Wifly Shield & Ardosc - setPrompt failed (Read 1 time) previous topic - next topic

mimi012

Hi

I need to send OSC messages with Arduino via wifi, I've found this lib to do this: https://github.com/Zapalot/ArdOscForWiFlyHQ

But if I upload this sketch example to send OSC:
Code: [Select]
#include <WiFlyHQ.h>
#include <ArdOSCForWiFlyHQ.h>

//uncomment this to use a software serial if you dont own a MEGA
//#include <SoftwareSerial.h>
//SoftwareSerial softSerial(softSerialRx,softSerialTx);

WiFly wifly;
OSCClient client(&wifly);
//create new osc message
OSCMessage global_mes;

int globalIntValue=0;
float globalFloatValue=1000;
char* globalString="foo";
void setup()
{
  Serial.begin(115200);
  //use the convenient setup. Replace <HardwareSerial> by <SoftwareSerial> if you use one.
  wifly.setupForUDP<HardwareSerial>(
    &Serial3,   //the serial you want to use (this can also be a software serial)
    115200, // if you use a hardware serial, I would recommend the full 115200
    true,        // should we try some other baudrates if the currently selected one fails?
    "WLAN-466B23",  //Your Wifi Name (SSID)
    "SP-213B33501", //Your Wifi Password
    "WiFly",                 // Device name for identification in the network
    "192.168.2.201",         // IP Adress of the Wifly. if 0 (without quotes), it will use dhcp to get an ip
    8000,                    // WiFly receive port
    "255.255.255.255",       // Where to send outgoing Osc messages. "255.255.255.255" will send to all hosts in the subnet
    8001,                     // outgoing port
    true        // show debug information on Serial
  );
  wifly.printStatusInfo(); //print some debug information
}

void loop()
{
  //note that the destination adress is set by setting the remote host of the wifly! 
  //three ways of sending messages...
 
  //simple but not as flexible: the convenience functions:
  client.sendInt(analogRead(A0),"/ard/A0Value");
  client.sendFloat((float)analogRead(A1)*5.0/255.0,"/ard/A1Voltage");

  //using a local message object allows to multiple additional parameters in a singel message:
  //loacal_mes,str is release by out of scope
  OSCMessage loacal_mes;
  loacal_mes.beginMessage("/ard/A2A3Value");
  loacal_mes.addArgInt32(analogRead(A2));
  loacal_mes.addArgInt32(analogRead(A3));
  client.send(&loacal_mes);
 
  //using a global message object and some global variables works as well
  global_mes.beginMessage("/ard/status");
  global_mes.addArgInt32(globalIntValue);
  global_mes.addArgFloat(globalFloatValue);
  global_mes.addArgString(globalString);

  client.send(&global_mes);
  global_mes.flush(); //object data clear

  globalIntValue++;
  globalFloatValue*=0.999;
}

I receive this error in serial monitor:
Quote
Free memory: 915
Trying to connect to this
Connecting to this using Baudrate:115200
setPrompt failed

I've buy this shield: https://www.sparkfun.com/products/9954
I'm working with aduino IDE 1.0.5
I've tried to connect the shield with the "official" Library and the IDE 0023, and it work great. https://forum.sparkfun.com/viewtopic.php?p=115626#p115626

I think it's because the shield use a SPI connection and the librarie (ArdOscForWiFlyHQ) is trying to communicate with a Rx Tx communication. 

I've see on this document a UART Device between Arduino and the Wifly: https://www.sparkfun.com/datasheets/DevTools/Arduino/WiFly_Shield-v17.pdf

Need I to by-pass this and connect the Serials pins directly on the Wifly Rx Tx?

Or I need to modify the exemple to communicate via SPI? How I must do this?

Thank in advance.

Go Up