Pages: [1]   Go Down
Author Topic: ardOSC and WIFI library help  (Read 1705 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Full Member
***
Karma: 0
Posts: 116
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hello

i am trying to get the ardosc library working with the wifi library to allow for some great realtime wireless control. The ArdOSC library work really well with the ethernet library and i was hoping it was going to be a straight forward port across to the wifi option (using the new arduino wifi shields) however i get some errors compiling which i am not sure how to fix. digging around online, it seems that the ardosc library uses some deep rooted functions of the ethernet library, but alas that is a bit out of my technical knowledge..

the code i have so far is this - which would just in theory allow for a fading control of an led over a wifi network using the OSC protocol:

Code:
/*
 
 This example connects to an unencrypted Wifi network.
 Then it prints the  MAC address of the Wifi shield,
 the IP address obtained, and other network details.

 Circuit:
 * WiFi shield attached
 
 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 */
 #include <SPI.h>
#include <ArdOSC.h>
#include <WiFi.h>

char ssid[] = "kazimier_workshop";     //  your network SSID (name)
char pass[] = "password";  // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status


int serverPort  = 9000;
int destPort=12000;

long val1 = 0;


OSCServer server;
OSCClient client;
int led1 = 6;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
 
  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while(true);
  }
 
 // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:   
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
   
  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
 
  server.begin(serverPort);
 
   server.addCallback("/1/light1",&func1);
}

void loop() {
  // check the network connection once every 10 seconds:
    if(server.aviableCheck()>0){
  Serial.println("alive! ");
  }
  analogWrite(led1, val1);
}


void func1(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val1 = (long)(value*255);
  Serial.println(val1);
}

when i try to compile i get the following messages:

Code:
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:22:27: error: utility/w5100.h: No such file or directory
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp: In member function 'int16_t OSCClient::sockOpen()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:39: error: 'W5100' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:40: error: 'SnSR' has not been declared
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:40: error: 'SnSR' has not been declared
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:48: error: 'SnMR' has not been declared

does anyone have any suggestions? or any experience with this?

all help greatly appreciated -

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49040
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Solving the first error may resolve the others. How have you tried to resolve it?
Logged

UK
Offline Offline
Full Member
***
Karma: 0
Posts: 116
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi paul

i haven't as yet tried to resolve it - i have used this library before with the ethernet shield and it never came up with any error messages when compiling, so not really sure where to start with it. but guessing it is to do with some function of the ethernet library that it wants to connect to, i thought that is why i needed to include the SPI.h library..
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49040
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i have used this library before with the ethernet shield and it never came up with any error messages when compiling
This library is missing a link.

It also seems unlikely that your WiFi shield has a W5100 chip on it, so any code that relies on a W5100 chip (with, for example, built in support for TCP/IP) isn't going to port well to another device without that built in support.
Logged

UK
Offline Offline
Full Member
***
Karma: 0
Posts: 116
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

oh.. that is a shame, as it seems like a natural progression to allow for wireless control with the same capabilities as the wired option, the OSC protocol is so well suited for realtime sequencing and performance environments, i have been using the ethernet shields with great success and was really excited about the prospect of making my projects go wirelessly, the osc protocol works really well wirelessly and there are some great apps that allow for building great interfaces.. the wifi shield i am using is this one: http://arduino.cc/en/Main/ArduinoWiFiShield
which i think does support TCP/IP but again sadly this is a bit above my technical knowledge, it is frustrating knowing that there has to be a solution out there to a problem but not having the necessary skill set to realise it
Logged

Offline Offline
Sr. Member
****
Karma: 7
Posts: 282
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

as it seems like a natural progression to allow for wireless control with the same capabilities as the wired option,

Unfortuantely that's an assumption that quite a few people make (me included ;-). The ArdOSC library uses some low level functions of the Ethernet library that "talk" directly to the Wizenet W5100 chip on the Ethernet shield. Using a different Ethernet shield, whether WiFi or Cable, that does not use this chip will most likely require you to find equivalent software functionality for that different chip that you can adapt the library to.

If you don't have that skill level ( I don't) then there still is an actually very simple WiFi solution that works perfectly for my project. Unfortunately, for now, you'll have to toss the WiFi shield and use a standard Ethernet shield, connected to a little pocket Router such as the TP-Link WR702n (approximately $30). My projects employs a Teensy++ 2 http://www.pjrc.com/teensy/index.html and a WIZ812 Ethernet Module http://www.saelig.com/product/ETH042.htm with the adapter http://www.pjrc.com/store/wiz812_adaptor.html. I am not trying to sell anything but listed these parts simply to help explain that I am not just suggesting something that may work but actually does work in my project.

The ArdOSC library is not the only library that depends on this low level functionality, btw, the DHCP/Bonjour libraries for example depend on the same low level functionality (w5100.h, w5100.cpp in the /utility subfolder).
« Last Edit: September 16, 2012, 07:10:53 pm by Headroom » Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Has anyone had a chance to look at the updated ArdOsc library made for the wifly module? https://github.com/Zapalot/ArdOscForWiFlyHQ unfortunately I have the arduino wifi module, not the wifly, but am planning to take a look and see if I can get it to communicate with my arduino...
Logged

Pages: [1]   Go Up
Jump to: