Lab_interaccio/2013/Ardumote
2025-02-25 21:29:42 +01:00
..
ArdOSCForWiFlyHQ.h second commit 2025-02-25 21:29:42 +01:00
Ardumote.ino second commit 2025-02-25 21:29:42 +01:00
Doxyfile second commit 2025-02-25 21:29:42 +01:00
ftp.cpp second commit 2025-02-25 21:29:42 +01:00
keywords second commit 2025-02-25 21:29:42 +01:00
keywords.txt second commit 2025-02-25 21:29:42 +01:00
LICENSE.txt second commit 2025-02-25 21:29:42 +01:00
Lisence.txt second commit 2025-02-25 21:29:42 +01:00
OSCArg.cpp second commit 2025-02-25 21:29:42 +01:00
OSCArg.h second commit 2025-02-25 21:29:42 +01:00
OSCClient.cpp second commit 2025-02-25 21:29:42 +01:00
OSCClient.h second commit 2025-02-25 21:29:42 +01:00
OSCcommon.h second commit 2025-02-25 21:29:42 +01:00
OSCDecoder.cpp second commit 2025-02-25 21:29:42 +01:00
OSCDecoder.h second commit 2025-02-25 21:29:42 +01:00
OSCEncoder.cpp second commit 2025-02-25 21:29:42 +01:00
OSCEncoder.h second commit 2025-02-25 21:29:42 +01:00
OSCMessage.cpp second commit 2025-02-25 21:29:42 +01:00
OSCMessage.h second commit 2025-02-25 21:29:42 +01:00
OSCServer.cpp second commit 2025-02-25 21:29:42 +01:00
OSCServer.h second commit 2025-02-25 21:29:42 +01:00
Pattern.cpp second commit 2025-02-25 21:29:42 +01:00
Pattern.h second commit 2025-02-25 21:29:42 +01:00
README second commit 2025-02-25 21:29:42 +01:00
README.txt second commit 2025-02-25 21:29:42 +01:00
WiFlyHQ.cpp second commit 2025-02-25 21:29:42 +01:00
WiFlyHQ.h second commit 2025-02-25 21:29:42 +01:00

A library for the Roving Networks WiFly RN-XV.

The library provides functions for setting up and managing the WiFly module,
sending UDP packets, opening TCP connections and sending and receiving data
over the TCP connection.

Example code to setup and use the hardware serial interface:

	Serial.begin(9600);
	wifly.begin(&Serial, NULL);

Setup and use a software serial interface:

	#include <SoftwareSerial.h>
	SoftwareSerial wifiSerial(8,9);

	wifiSerial.begin(9600);
	wifly.begin(&wifiSerial);

Join a WiFi network:

	wifly.setSSID("mySSID");
	wifly.setPassphrase("myWPApassword");
	wifly.enableDHCP();
	wifly.join();

Create an Ad Hoc WiFi network on channel 10:

	wifly.createAdhocNetwork("myssid", 10);

Send a UDP packet:

	wifly.setIpProtocol(WIFLY_PROTOCOL_UDP);
	wifly.sendto("Hello, world", "192.168.1.100", 2042);

Open a TCP connection and send some data, and close the connection:

	wifly.setIpProtocol(WIFLY_PROTOCOL_TCP);
	wifly.open("192.168.1.100",8042);
	wifly.println("Hello, world!");
	wifly.close();

Receive UDP or TCP data (assumes software serial interface):

	if (wifly.available() > 0) {
	    Serial.write(wifly.read());
	}

Easy handling of multiple receive options with multiMatch_P()::

        if (wifly.available() > 0) {
	    int match = wifly.multiMatch_P(100, 3,
			    F("button"), F("slider="), F("switch="));
	    switch (match) {
	    case 0: /* button */
		Serial.print(F("button: pressed"));
		break;
	    case 1: /* slider */
		int slider = wifly.parseInt();
		Serial.print(F("slider: "));
		Serial.println(slider);
		break;
	    case 2: /* switch */
		char ch = wifly.read();
		Serial.print(F("switch: "));
		Serial.println(ch);
		break;
	    default: /* timeout */
		break;
	    }
	}

Limitations with WiFly RN-XV rev 2.32 firmware
1. Cannot determine the IP address of the TCP client that has connected.
2. Changing the local port does not take effect until after a save and reboot.
3. Closing a TCP connection may not work. Client may stay connected
   and send additional data. Packet analysis shows that no FIN is sent
   by the WiFly, but it still sends the *CLOS* message back to the
   arduino.
4. Only supports one TCP connection at a time, which means its easy
   for a web browser to lock out other users.
5. Changing the flush timeout (set comm time x) does not take affect until 
   after a save and reboot.

To do:
1. Add FTP support.