// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
// This is the webpage that is served up by the webserver
const prog_char webpage[] PROGMEM = {"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<center><h1>Hello TEST!!!</h1><form method=\"get\" action=\"0\">Toggle LED:<input type=\"submit\" name=\"0\" value=\"LED1\"></input></form></center>"};
boolean controlpage(char* URL)
{
// Serial.println(URL);
if (strcmp(URL, "/") == 0)
{
sendpage();
return true;
}
else
{
if(URL[1] == '?')
{
if((URL[2] == 'V') && (URL[3] == '='))
{
switch(URL[4])
{
case 'F':
forward(0, 0);
break;
case 'B':
back(0, 0);
break;
case 'L':
left(0, 0);
break;
case 'R':
right(0, 0);
break;
case 'S':
motorstop(0, 0);
break;
}
}
sendpage();
return true;
}
}
}
可以參考我的Blog. http://sinocgtchen.blogspot.com作者: zero7386 時間: 2011-9-19 10:32
sinocgt大大,謝謝你的幫忙,想請問一下,為什麼我用WiShield example 中的 SimpleServer,什麼都還沒有改,按compiling就出現一堆錯誤,這是找不到WiServer那個檔的意思嗎?
SimpleServer.cpp.o: In function `loop':
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:74: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:74: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:74: undefined reference to `Server::server_task()'
SimpleServer.cpp.o: In function `setup':
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:64: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:64: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:64: undefined reference to `Server::init(unsigned char (*)(char*))'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:68: undefined reference to `Server::enableVerboseMode(unsigned char)'
SimpleServer.cpp.o: In function `sendMyPage(char*)':
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:50: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:50: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:51: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:51: undefined reference to `WiServer'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:52: undefined reference to `WiServer'
SimpleServer.cpp.o:C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\build2630776630530569053.tmp/SimpleServer.cpp:52: more undefined references to `WiServer' follow作者: zero7386 時間: 2011-9-19 10:54
sinocgt大大,謝謝,我上面的問題已經解開了,原來是要到apps-conf.h裡把
imply comment out the #define for APP_WEBSERVER and uncomment the #define for APP_WISERVER as shown here:
小弟英文不好,因為都沒有中文網站在說明,只好硬著頭皮去把英文網頁看完,^^,才發現原來是這麼簡單的問題作者: sinocgt 時間: 2011-9-19 11:02
要去修改WiShield 目錄下的apps-conf.h, 把#define APP_WEBSERVER 打開(其他remark), 這個檔案是config檔,看你是要用哪一個應用程式例如APP_SOCKAPP, UIP_DHCP,.... 不是很難看了你就知道如何設定.作者: sinocgt 時間: 2011-9-19 11:04
抱歉, 你現在改用SimpleServer,所以把#define APP_WISERVER打開即可.作者: Eason 時間: 2011-10-7 21:34
用了很久終於可以把範例的程式燒進去Arduino了!!
真是超感動的!!><
真是感謝前輩啊!!~
要測試的話到下列往址照著做:
The best place to start would be to install the WiShield drivers using the instructions on the Async Labs wiki, and test out one or two example sketches to make sure you have the driver and shield working correctly. http://asynclabs.com/wiki/index.php?title=AsyncLabsWiki
Test the "SimpleServer" example sketch and make sure you can access the demo page in your browser.
--------------------
Compatible with Asynclab wifi shield!」 This would have led me to the AsyncLabs Wiki and would have saved me a lot of time.
==========================
一步一步的做, 有問題再提出來討論,作者: Eason 時間: 2011-10-11 15:36
可以了可以了!!!!~~~感謝各位大大!!!