Arduino + Wifi + Blinkm RGB

Sorry to use this so often but maybe you can tell me if i’m going in the right direction

I have Arduino, with Wifi shield 2.0, Simpleserver is running webpage shows connects to router fine.

I’m trying to get a webpage to change blinkm from red/green/blue, eventually i want to have input values to change it, right now i have just set “Green” to 255, to see if i can get green to turn on, which it wont :frowning:

but here’s the code and it’s not quiet functioning to well. the onsubmit doesnt quiet work…

/*

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

#include <WiServer.h>
#include <BlinkM_funcs.h>
#include “Wire.h”

#define blinkm_addr 0x00
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
byte r,g,b;
unsigned char local_ip = {192,168,0,220}; // IP address of WiShield
unsigned char gateway_ip = {192,168,0,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 = {“LyghtHouse”}; // max 32 bytes

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

// WPA/WPA2 passphrase
const prog_char security_passphrase PROGMEM = {“FFFFFFFFFFFFFFFFFFFFFFFFFF”}; // 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 ----------------------------------------

// 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("");
WiServer.print(“Hello World!”);
WiServer.print("
“);
WiServer.print(“Toggle LED:<input type=“submit” name=“0” value=“Red”>”);
WiServer.print(”
“);
WiServer.print(“Toggle LED:<input type=“submit” name=“0” value=“Blue”>”);
WiServer.print(”
“);
WiServer.print(“Toggle LED:<input type=“submit” name=“0” value=“Green”><onsubmit=“BlinkM_setRGB (blinkm_addr, 0x00,0xFF,0x00 )””);
WiServer.print(”
“);
WiServer.print(”");
WiServer.print("");

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

void setup() {
BlinkM_beginWithPower();
BlinkM_stopScript( blinkm_addr ); // turn off startup script

// 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);
}

Made a change to the RGB values and such

put in 3x byte variables r,g,b… and change to input text boxes, and put in submit button, now trying to have input values change values of variable.

and put in this

// 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("");
WiServer.print(“RGB LED Testing!”);
WiServer.print("
“);
WiServer.print(” Red: <input type=“text” name=“Red”>Green: <input type=“text” name=“Green” />Blue: <input type=“text” name=“Blue” />");
WiServer.print("
“);
WiServer.print(“Submit:<input type=“submit” name=“0” value=“submit”><onsubmit=“set r=“Red” set=g"Green” set=b=“Blue” )””);
WiServer.print("");
WiServer.print("");

// URL was recognized
return true;

Got it!

Now have servos + leds and website running woot !