如何使用Arduino 制作 串口转WiFi的服务器
推荐回答
#include <WiShield.h>#define WIRELESS_MODE_INFRA 1#define WIRELESS_MODE_ADHOC 2// Wireless configuration parameters ----------------------------------------byte local_ip[] = {10,0,0,3}; // IP address of WiShieldbyte gateway_ip[] = {10,0,0,1}; // router or gateway IP addressbyte subnet_mask[] = {255,255,255,0}; // subnet mask for the local networkprog_char ssid[] PROGMEM = {"cutedigi"}; // max 32 bytesunsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2// WPA/WPA2 passphraseconst prog_char security_passphrase[] PROGMEM = {"big_secret"}; // max 64 characters// WEP 128-bit keys// sample HEX keysprog_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 deviceunsigned char wireless_mode = WIRELESS_MODE_INFRA;unsigned char ssid_len;unsigned char security_passphrase_len;