WiShield 2.0 and Arduino 1.0

hi there, I keep gettting this error message when trying to compile the simpleserver.pde file from their samples directory.

In file included from SimpleServer_cpp:6:
c:\users\walter\documents\Arduino\libraries\WiShield/WiServer.h:198 error: coonfilicting return type specified for 'virtual void server::write(uint8_t)'
c:\arduino\hardware\arduino\cores\arduino/print.h:48 error overriding 'virutal size_t Print::write(uint_t)'

I checked line 198 in WiServer.h and it reads:

virtual void write(uint8_t);

I checked line 48 in print.h and it reads:

virtual size_t write(uint8_t) = 0;

I'm afraid I am lost...

this all used to work nice before I upgraded to arduino 1.0 in .21 it all worked, and now I am having difficulty getting it working in .21 on my mac since messing around... did a fresh install on 1.0 on my pc and want to get that working if possible ...

if somene can help with the quoted errors, it will allow me to continue :slight_smile: any help appreciated... I did do a search but the solutions I found were difficult to follow... and I had no luck with them...

Anyone with a wishield, any help would be great...

First of all you have to use the oo22 or oo23 arduino IDE because for sure there is something phishy in arduino 1.0 IDE as the WiShield code that compiles perfectly in 0022 or 0023 shows additional problems in 1.0 and then refer to my post >> http://arduino.cc/forum/index.php/topic,92240.msg692866.html#msg692866

also make virtual void write(uint8_t); as virtual size_t write(uint8_t); under WiServer.h if then it shows error that it is unable to find wiring.h then load wiring.h library into the sketch after inserting the library in WiShield library directory

plus also change the app-conf.h file (im giving to you that in attachment)

apps-conf.h (1.77 KB)

I'm starting from scratch,
I'm downloading and installing Arduino .23
installed it.

now I will get the async files from the site again and install them. I'm hoping this will work.
the above did not really work for me.... still got errors... more errors infact...
very discuraged...

I'm hoping with a new install of 23 and 1.0 removed, and new copies of files from the ASYNC site, or where ever,
I will get this thing running again....

I am looking for the WiShield folder
and the WiServer library folder

hoping that will be enough... :slight_smile:

thanks for your help.... I was wondering, if I don't have any luck would it be too much trouble to zip your two library folders and attach them? incase I am missing something very basic...

thanks again....

ok downloaded zip file from the Github.
installed a clean version of Arduino .23
put the library files in the \documents\arduino\library folder
called WiShild

opened up the simple server example:

/*

  • A simple sketch that uses WiServer to serve a web page
    */

#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,1,200}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"Arduino"}; // max 32 bytes

unsigned char security_type = 1; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = {
0x04, 0x13, 0x65, 0x10, 0x20, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------

// This is our page serving function that generates web pages
boolean sendMyPage(char* URL) {

// Check if the requested URL matches "/"
if (strcmp(URL, "/") == 0) {
// Use WiServer's print and println functions to write out the page content
WiServer.print("");
WiServer.print("Hello World!");
WiServer.print("");

// URL was recognized
return true;
}
// URL not found
return false;
}

void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);

// Enable Serial output and ask WiServer to generate log messages (optional)
Serial.begin(57600);
WiServer.enableVerboseMode(true);
}

void loop(){

// Run WiServer
WiServer.server_task();

delay(10);
}


compiles it and got this error:

SimpleServertest.cpp.o: In function loop': SimpleServertest.cpp:74: undefined reference to WiServer'
SimpleServertest.cpp:74: undefined reference to WiServer' SimpleServertest.cpp:74: undefined reference to Server::server_task()'
SimpleServertest.cpp.o: In function setup': SimpleServertest.cpp:64: undefined reference to WiServer'
SimpleServertest.cpp:64: undefined reference to WiServer' SimpleServertest.cpp:64: undefined reference to Server::init(unsigned char ()(char))'
SimpleServertest.cpp:68: undefined reference to Server::enableVerboseMode(unsigned char)' SimpleServertest.cpp.o: In function sendMyPage(char*)':
SimpleServertest.cpp:50: undefined reference to WiServer' SimpleServertest.cpp:50: undefined reference to WiServer'
SimpleServertest.cpp:51: undefined reference to WiServer' SimpleServertest.cpp:51: undefined reference to WiServer'
SimpleServertest.cpp:52: undefined reference to WiServer' SimpleServertest.cpp.o:SimpleServertest.cpp:52: more undefined references to WiServer' follow

no idea what the heck I am doing wrong... now I'm depressed...

So web server example works...
no compiling errors... but it calls WiShield not WiServer where all the problems seem to stem...
I hope I can figure it out...

:slight_smile: cheers. :slight_smile: just an update... still would like to get WiServer.h working....

Hi Good to know that something worked,

The Web Server example works its because it calls for WiShield, and the errors that now you are facing TRY CHANGING THE apps-conf.h i ATTACHED in my previous post but also keep the original apps-conf.h as a back-up in case bad things happen(i think most probably your problem would now be solved)

also those errors happen because the arduino IDE is not able to locate the referenced WiServer.h lib as its commented as a comment(disabled in apps-conf.h) with some other library references.

Update, started with fresh install, fresh copy of WiShield library and examples.
I renamed my apps-conf.h file and copied in yours...
now 3 of the example sketches in WiShield folder compile properly...

these ones do:

SimpleTweeter compiles fine
SImpleServer compiles fine
SimpleClient compiles fine

these ones error out when compiling:

SocketApp
get the following error:

In file included from socketapp.c:46:
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/socketapp.h:52: error: conflicting types for 'uip_tcp_appstate_t'
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/server.h:65: error: previous declaration of 'uip_tcp_appstate_t' was here

UDPApp
get the following error:

In file included from udpapp.c:37:
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/udpapp.h:42: error: conflicting types for 'uip_tcp_appstate_t'
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/server.h:65: error: previous declaration of 'uip_tcp_appstate_t' was here
udpapp.c: In function 'udpapp_init':
udpapp.c:58: error: dereferencing pointer to incomplete type

WebClient
get the following error:

n file included from webclient.c:37:
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/webclient.h:106: error: conflicting types for 'uip_tcp_appstate_t'
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/server.h:65: error: previous declaration of 'uip_tcp_appstate_t' was here

WebServer
get the following error:

In file included from webserver.c:37:
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/webserver.h:43: error: conflicting types for 'uip_tcp_appstate_t'
/Users/waltermiraglia/Documents/Arduino/libraries/WiShield/server.h:65: error: previous declaration of 'uip_tcp_appstate_t' was here

so much further ahead... but as it turns out web server is the one I really need :slight_smile: any additional help would be great... :slight_smile:

at this stage I am good to go..
I found a sketch called WiShieldLed and it allows me to turn led's on and off via web interface :slight_smile:
it's what I was looking for... and it compiles perfectly...

thank you for your help, getting the other sketches working is great... :slight_smile: I suspect I will work my way around those other issues when I need to but thanks to your help, I can continue with my internet based treat dispenser... :slight_smile:

Its fine!

this is the sketch I ended up going with, and it works :slight_smile: I changed it to allow for 4 leds, ( just to see if I could do it ) this is the original 3 led sketch :slight_smile:

/*

  • A simple sketch that uses WiServer to serve a web page !! that kim messed with.
    */

#include <WiServer.h>
#include <string.h>

#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2

#define ledPin1 5
#define ledPin2 6
#define ledPin3 7

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = { 10,1,1,5}; // IP address of WiShield
unsigned char gateway_ip[] = { 192,168,1,1}; // router or gateway IP address
unsigned char subnet_mask[] = { 255,0,0,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = { "DLINK"}; // max 32 bytes
unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = { "12345678"}; // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;

// End of wireless configuration parameters ----------------------------------------

boolean states[3]; //holds led states
char stateCounter; //used as a temporary variable
char tmpStrCat[64]; //used in processing the web page
char stateBuff[4]; //used in text processing around boolToString()
char numAsCharBuff[2];
char ledChange;

void boolToString (boolean test, char returnBuffer[4])
{
returnBuffer[0] = '\0';
if (test)
{
strcat(returnBuffer, "On");
}
else
{
strcat(returnBuffer, "Off");
}
}

void printStates()
{
for (stateCounter = 0 ; stateCounter < 3; stateCounter++)
{
boolToString(states[stateCounter], stateBuff);

Serial.print("State of ");
Serial.print(stateCounter);
Serial.print(": ");
Serial.println(stateBuff);
}
}

void writeStates()
{
//set led states
digitalWrite(ledPin1, states[0]);
digitalWrite(ledPin2, states[1]);
digitalWrite(ledPin3, states[2]);
}

// This is our page serving function that generates web pages
boolean sendPage(char* URL) {

Serial.println("Page printing begun");

printStates();
writeStates();

//check whether we need to change the led state
if (URL[1] == '?' && URL[2] == 'L' && URL[3] == 'E' && URL[4] == 'D') //url has a leading /
{
ledChange = (int)(URL[5] - 48); //get the led to change.

for (stateCounter = 0 ; stateCounter < 3; stateCounter++)
{
if (ledChange == stateCounter)
{
states[stateCounter] = !states[stateCounter];
Serial.print("Have changed ");
Serial.println(ledChange);
}
}

//after having change state, return the user to the index page.
WiServer.print("");
return true;
}

if (strcmp(URL, "/") == false) //why is this not true?
{
WiServer.print("Led switch");

WiServer.print("Please select the led state:\n");
for (stateCounter = 0; stateCounter < 3; stateCounter++) //for each led
{
numAsCharBuff[0] = (char)(stateCounter + 49); //as this is displayed use 1 - 3 rather than 0 - 2
numAsCharBuff[1] = '\0'; //strcat expects a string (array of chars) rather than a single character.
//This string is a character plus string terminator.

tmpStrCat[0] = '\0'; //initialise string
strcat(tmpStrCat, "<a href=?LED"); //start the string
tmpStrCat[12] = (char)(stateCounter + 48); //add the led number
tmpStrCat[13] = '\0'; //terminate the string properly for later.

strcat(tmpStrCat, ">Led ");
strcat(tmpStrCat, numAsCharBuff);
strcat(tmpStrCat, ": ");

boolToString(states[stateCounter], stateBuff);
strcat(tmpStrCat, stateBuff);
strcat(tmpStrCat, " "); //we now have something in the range of Led 0: Off

WiServer.print(tmpStrCat);
}

WiServer.print(" ");
return true;
}
}

void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);

Serial.begin(9600);
WiServer.init(sendPage);
states[0] = false;
states[1] = false;
states[2] = false;
}

void loop(){
// Run WiServer
WiServer.server_task();

delay(10);
}

Hey!

I got same issue, the Webserver works but the client examples show me the same problems as mentioned in earlier posts.

Is there anyone who solved this issue? Cant belive that I am the only one with this WIFI Shield how wants to use it as a client :frowning: