Skip to main content
formatting
Source Link
sachleen
  • 7.6k
  • 5
  • 40
  • 57

#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1 //#define WIRELESS_MODE_ADHOC 2

// Wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = {146, 227, 174, 29}; // Indirizzo IP unsigned char gateway_ip[] = {146, 227, 175, 254}; // Indirizzo gateway IP unsigned char subnet_mask[] = {255, 255, 248, 0}; // Subnet Mask const prog_char ssid[] PROGMEM = {"enduroam"}; // SSID access point

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

// WPA/WPA2 passphrase const prog_char security_passphrase[] PROGMEM = {"EAP-MSCHAP V2"}; // max 64 characters // 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) {

#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1
//#define WIRELESS_MODE_ADHOC   2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {146, 227, 174, 29};      // Indirizzo IP
unsigned char gateway_ip[] = {146, 227, 175, 254};      // Indirizzo gateway IP
unsigned char subnet_mask[] = {255, 255, 248, 0};   // Subnet Mask
const prog_char ssid[] PROGMEM = {"enduroam"};      // SSID access point

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

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"EAP-MSCHAP V2"};  // max 64 characters
// 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("<html>");
        WiServer.print("Hello World!");
        WiServer.print("</html>");
        
        // URL was recognized
        return true;
    }
    // URL not found
    return false;
}


void setup() {
  // 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);
}

}

void setup() { // 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); }

#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1 //#define WIRELESS_MODE_ADHOC 2

// Wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = {146, 227, 174, 29}; // Indirizzo IP unsigned char gateway_ip[] = {146, 227, 175, 254}; // Indirizzo gateway IP unsigned char subnet_mask[] = {255, 255, 248, 0}; // Subnet Mask const prog_char ssid[] PROGMEM = {"enduroam"}; // SSID access point

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

// WPA/WPA2 passphrase const prog_char security_passphrase[] PROGMEM = {"EAP-MSCHAP V2"}; // max 64 characters // 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("<html>");
    WiServer.print("Hello World!");
    WiServer.print("</html>");
    
    // URL was recognized
    return true;
}
// URL not found
return false;

}

void setup() { // 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); }

#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1
//#define WIRELESS_MODE_ADHOC   2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {146, 227, 174, 29};      // Indirizzo IP
unsigned char gateway_ip[] = {146, 227, 175, 254};      // Indirizzo gateway IP
unsigned char subnet_mask[] = {255, 255, 248, 0};   // Subnet Mask
const prog_char ssid[] PROGMEM = {"enduroam"};      // SSID access point

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

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"EAP-MSCHAP V2"};  // max 64 characters
// 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("<html>");
        WiServer.print("Hello World!");
        WiServer.print("</html>");
        
        // URL was recognized
        return true;
    }
    // URL not found
    return false;
}


void setup() {
  // 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);
}
Source Link

#include <WiServer.h>

#define WIRELESS_MODE_INFRA 1 //#define WIRELESS_MODE_ADHOC 2

// Wireless configuration parameters ---------------------------------------- unsigned char local_ip[] = {146, 227, 174, 29}; // Indirizzo IP unsigned char gateway_ip[] = {146, 227, 175, 254}; // Indirizzo gateway IP unsigned char subnet_mask[] = {255, 255, 248, 0}; // Subnet Mask const prog_char ssid[] PROGMEM = {"enduroam"}; // SSID access point

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

// WPA/WPA2 passphrase const prog_char security_passphrase[] PROGMEM = {"EAP-MSCHAP V2"}; // max 64 characters // 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("<html>");
    WiServer.print("Hello World!");
    WiServer.print("</html>");
    
    // URL was recognized
    return true;
}
// URL not found
return false;

}

void setup() { // 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); }