by thanosgen » Tue Jul 13, 2010 11:40 am
i have this code and i want to make i adhoc connection with blackwidow but i can't.something is wrong.i have in alagog pin a sensor of the air.how make this simple program?
- Code: Select all
#include <WiServer.h>
#include <string.h>
#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2
//Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = { 192,168,1,5}; // IP address of WiShield
unsigned char gateway_ip[] = { 192,168,1,254}; // router or gateway IP address
unsigned char subnet_mask[] = { 255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM = { "all"}; // 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
};
unsigned char wireless_mode = WIRELESS_MODE_ADHOC;
unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------
int val;
int vala=0;
val = analogRead(0); // read analog input pin 0
vala=val/10;
//Serial.print(vala, DEC); // prints the value read
// Serial.print("%");
boolean sendMyPage(char* URL) {
// Check if the URL matches "/"
if (strcmp(URL, "/") == 0) {
WiServer.print("<html>");
WiServer.print("<body><div align=right>TEMP=,vala </body>");
WiServer.print("</html>");
// Use print and println functions to write out the page
// URL was recognized
return true;
}
// URL not found
return false;
}
void setup()
{
Serial.begin(19200);
//Serial.println("Starting up");
WiServer.init(sendMyPage);
}
void loop()
{
WiServer.server_task();
}