Hi,
i'm having some troubles with extracting values from a website, using a WiShield (asynclabs) and Arduino un0, in order to light a rgb led.
My arduino is able to connect to the webpage where i want to extract my values, and to print on the serial monitor the result: the html code of the pag which is:
(yes Arduino has to be programed as a client, and yes it absolutely has to be connected via wifi)
I now want to extract the values for r,g,b, and parse them into 3 ints: red, green, blue (0-255) on the arduino, so i can light the 3 leds accordingly.
I know textFinder library can do this, but only for Ethernet connections, and I don't know if the new find() function, that appears to have been implemented with Arduino 1.0, works for the WiShield.
The arduino code that i'm using is as follows, and is based on the example for simple client present in the asynclabs wishield library.
If any of you has an idea on how to solve this please tell me!
If anyone knows where i can get more info on the new find() function (besides arduino.cc reference) i would really appreciate it, even if i have to look at the Core libraries of the Arduino.
Thanks,
/*
- A simple sketch that uses WiServer to get the hourly weather data from LAX and prints
- it via the Serial API
*/
#include <WiServer.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {10,0,1,3}; // IP address of WiShield
unsigned char gateway_ip[] = {10,0,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 = {"AABBCC"}; // 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 = {"aabbcc"}; // 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
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------
void printData(char* data, int len) {
while (len-- > 0) {
Serial.print(*(data++));
}
}
uint8 ip[] = {1,2,3,4};
GETrequest getPage(ip, 80, "www.aabbcc.com", "/abc.html");
int testing;
void setup(){
WiServer.init(NULL);
//WiServer.enableVerboseMode(true);
Serial.begin(9600);
Serial.print("Connexion wifi lancee");
getPage.setReturnFunc(printData);
delay(1000);
}
long updateTime = 0;
void loop(){
if (millis() >= updateTime) {
getPage.submit();
// Get another update one minute from now
updateTime += 1000 * 60 * 01;
}
WiServer.server_task();
}