OK so things are coming along but for some reason, it seems there is some issue in sendmypage that causes things to not work. Here is the code thus far:
/*
* A simple sketch that uses WiServer to serve a web page
*/
#include <WiServer.h>
#include <Servo.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,43,7}; // IP address of WiShield
unsigned char gateway_ip[] = {192,168,43,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 = {"Deep Thought"}; // 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 = {"improbabilitydrive69"}; // 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 ----------------------------------------
Servo Drive;
Servo Steer;
Servo Swing;
// 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("<html>");
WiServer.print("<HEAD><H3>Test
Web Control Page</H3><TITLE>HOPE</TITLE></HEAD>");
WiServer.print("<BODY>");
WiServer.print("Foward-*Stop*-Reverse
");
WiServer.print("<a href=\"http://192.168.43.7:80/F-F\" target=\"inlineframe\">F-F</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/S-F\" target=\"inlineframe\">S-F</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/X-FR\" target=\"inlineframe\">+-STOP-+</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/F-R\" target=\"inlineframe\">F-R</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/S-R\" target=\"inlineframe\">S-R</a>|");
WiServer.print("
Turn-L-*Stop*-Turn-R
");
WiServer.print("<a href=\"http://192.168.43.7:80/F-Lt\" target=\"inlineframe\">F-L</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/S-Lt\" target=\"inlineframe\">S-L</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/X-T\" target=\"inlineframe\">+-STOP-+</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/F-Rt\" target=\"inlineframe\">F-R</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/S-Rt\" target=\"inlineframe\">S-R</a>|");
WiServer.print("
Swing-U-*Stop*-Swing-D
");
WiServer.print("<a href=\"http://192.168.43.7:80/F-U\" target=\"inlineframe\">F-L</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/S-U\" target=\"inlineframe\">S-L</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/X-S\" target=\"inlineframe\">STOP</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/F-D\" target=\"inlineframe\">F-R</a>|");
WiServer.print("<a href=\"http://192.168.43.7:80/S-D\" target=\"inlineframe\">S-R</a>|");
//This holds the html answer of the moves
WiServer.print("<IFRAME name=inlineframe src='res://D:\\WINDOWS\\System32\\shdoclc.dll/dnserror.htm' width=1 height=1></IFRAME>");
WiServer.print("</BODY>");
WiServer.print("</html>");
// URL was recognized
return true;
}
//Drive Commands ------------------------------------------
if (strcmp(URL, "/F-F") == 0) {
Serial.println("Full Forward"); // so I can keep track of what is loaded
Drive.writeMicroseconds(2000); // Full Forward
}
if (strcmp(URL, "/S-F") == 0) {
Serial.println("Slow Forward"); // so I can keep track of what is loaded
Drive.writeMicroseconds(1700); // Slow Forward
}
if (strcmp(URL, "/X-FR") == 0) {
Serial.println("Stop Drive"); // so I can keep track of what is loaded
Drive.writeMicroseconds(1500); // Stop Drive
}
if (strcmp(URL, "/F-R") == 0) {
Serial.println("Full Reverse"); // so I can keep track of what is loaded
Drive.writeMicroseconds(1000); // Full Reverse
}
if (strcmp(URL, "/S-R") == 0) {
Serial.println("Slow Reverse"); // so I can keep track of what is loaded
Drive.writeMicroseconds(1300); // Slow Reverse
}
//Steer Commands -----------------------------------------
if (strcmp(URL, "/F-Rt") == 0) {
Serial.println("Full Right"); // so I can keep track of what is loaded
Steer.writeMicroseconds(1000); // Full Right
}
if (strcmp(URL, "/S-Rt") == 0) {
Serial.println("Slow Right"); // so I can keep track of what is loaded
Steer.writeMicroseconds(1300); // Slow Right
}
if (strcmp(URL, "/X-T") == 0) {
Serial.println("Stop Steer"); // so I can keep track of what is loaded
Steer.writeMicroseconds(1500); // Stop Steer
}
if (strcmp(URL, "/F-Lt") == 0) {
Serial.println("Full Left"); // so I can keep track of what is loaded
Steer.writeMicroseconds(1700); // Full Left
}
if (strcmp(URL, "/S-Lt") == 0) {
Serial.println("Slow Left"); // so I can keep track of what is loaded
Steer.writeMicroseconds(2000); // Slow Left
}
//Swing Commands -----------------------------------------
if (strcmp(URL, "/F-U") == 0) {
Serial.println("Full Up Swing"); // so I can keep track of what is loaded
Swing.writeMicroseconds(1000); // Full Up Swing
}
if (strcmp(URL, "/S-U") == 0) {
Serial.println("Slow Up Swing"); // so I can keep track of what is loaded
Swing.writeMicroseconds(1300); // Slow Up Swing
}
if (strcmp(URL, "/X-S") == 0) {
Serial.println("Stop Swing"); // so I can keep track of what is loaded
Swing.writeMicroseconds(1500); // Stop Swing
}
if (strcmp(URL, "/F-D") == 0) {
Serial.println("Slow Down Swing"); // so I can keep track of what is loaded
Swing.writeMicroseconds(1700); // Slow Down Swing
}
if (strcmp(URL, "/S-D") == 0) {
Serial.println("Full Down Swing"); // so I can keep track of what is loaded
Swing.writeMicroseconds(2000); // Full Up Swing
}
// URL not found
return false;
}
void setup() {
// Initialize WiServer and have it use the sendMyPage function to serve pages
WiServer.init(sendMyPage);
//Serial link for monitoring
Serial.begin(57600);
// Ask WiServer to generate log messages (optional)
WiServer.enableVerboseMode(true);
Serial.println("Serial Online"); // so I can keep track of what is loaded
Serial.println("WiServer Online"); // so I can keep track of what is loaded
//Drive.attach(10);
Drive.attach(5);
Steer.attach(6);
Swing.attach(9);
}
void loop(){
// Run WiServer
WiServer.server_task();
delay(10);
}
Any thoughts? And thanks for all the help so far...