Buenas a todos,
Remito este post ya desde la desesperaci贸n...
Para ponernos en situaci贸n os dire que intento poner en marcha una tarjeta wifi WfifiBee de Tinyshine con un shield Xbee de SainSmart en un Arduino Mega 2560. Utilizando la libreria WifliHQ...
Y cuando lo intento, lo unico que consigo es que me falle, el problema parece ser que comparten los mismos pins de puerto serie de comunicaciones, tanto el arduino como el shield XBee, para ello intento cambiar los puertos de comunicacion del Xbee mediante la libreria SoftwareSerial.h... Pero no he dado con la soluci贸n...
La tarjeta Xbee y el shield funcionan porque poniendo la tarjeta en modo de configuraci贸n, desde la consola la he configurado y puesto en red y soy capaz de hacer PING al arduino desde un pc de mi red, pero me gustar铆a poder controlar tanto la configuracion como los parametros desde el propio arduino...
Utilizando cualquier de los codigos de ejemplo de la libreria WIFLYHQ da error: resultado de ejecuci贸n del ejemplo de HttpClient de la libreria WIFLYHQ:
Starting
Free memory: 6708
setPrompt failed
Failed to enter command mode
Failed to start wifly
El codigo en cuesti贸n:
/*
* WiFlyHQ Example httpclient.ino
*
* This sketch implements a simple Web client that connects to a
* web server, sends a GET, and then sends the result to the
* Serial monitor.
*
* This sketch is released to the public domain.
*
*/
#include <WiFlyHQ.h>
#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(8,9);
//#include <AltSoftSerial.h>
//AltSoftSerial wifiSerial(8,9);
WiFly wifly;
/* Change these to match your WiFi network */
const char mySSID[] = "myssid";
const char myPassword[] = "my-wpa-password";
//const char site[] = "arduino.cc";
//const char site[] = "www.google.co.nz";
const char site[] = "hunt.net.nz";
void terminal();
void setup()
{
聽 聽char buf[32];
聽 聽Serial.begin(115200);
聽 聽Serial.println("Starting");
聽 聽Serial.print("Free memory: ");
聽 聽Serial.println(wifly.getFreeMemory(),DEC);
聽 聽wifiSerial.begin(9600);
聽 聽if (!wifly.begin(&wifiSerial, &Serial)) {
聽 聽 聽 聽Serial.println("Failed to start wifly");
terminal();
聽 聽}
聽 聽/* Join wifi network if not already associated */
聽 聽if (!wifly.isAssociated()) {
/* Setup the WiFly to connect to a wifi network */
Serial.println("Joining network");
wifly.setSSID(mySSID);
wifly.setPassphrase(myPassword);
wifly.enableDHCP();
if (wifly.join()) {
聽 聽Serial.println("Joined wifi network");
} else {
聽 聽Serial.println("Failed to join wifi network");
聽 聽terminal();
}
聽 聽} else {
聽 聽 聽 聽Serial.println("Already joined network");
聽 聽}
聽 聽//terminal();
聽 聽Serial.print("MAC: ");
聽 聽Serial.println(wifly.getMAC(buf, sizeof(buf)));
聽 聽Serial.print("IP: ");
聽 聽Serial.println(wifly.getIP(buf, sizeof(buf)));
聽 聽Serial.print("Netmask: ");
聽 聽Serial.println(wifly.getNetmask(buf, sizeof(buf)));
聽 聽Serial.print("Gateway: ");
聽 聽Serial.println(wifly.getGateway(buf, sizeof(buf)));
聽 聽wifly.setDeviceID("Wifly-WebClient");
聽 聽Serial.print("DeviceID: ");
聽 聽Serial.println(wifly.getDeviceID(buf, sizeof(buf)));
聽 聽if (wifly.isConnected()) {
聽 聽 聽 聽Serial.println("Old connection active. Closing");
wifly.close();
聽 聽}
聽 聽if (wifly.open(site, 80)) {
聽 聽 聽 聽Serial.print("Connected to ");
Serial.println(site);
/* Send the request */
wifly.println("GET / HTTP/1.0");
wifly.println();
聽 聽} else {
聽 聽 聽 聽Serial.println("Failed to connect");
聽 聽}
}
void loop()
{
聽 聽if (wifly.available() > 0) {
char ch = wifly.read();
Serial.write(ch);
if (ch == '\n') {
聽 聽/* add a carriage return */
聽 聽Serial.write('\r');
}
聽 聽}
聽 聽if (Serial.available() > 0) {
wifly.write(Serial.read());
聽 聽}
}
/* Connect the WiFly serial to the serial monitor. */
void terminal()
{
聽 聽while (1) {
if (wifly.available() > 0) {
聽 聽Serial.write(wifly.read());
}
if (Serial.available() > 0) {
聽 聽wifly.write(Serial.read());
}
聽 聽}
}
Alguien me puede dar luz sobre el tema? porque ando ya perdido!...