嗨,我不能把这个程序变成访问点,你能帮我吗?
代码:
全选#include
#include \"indexl.h\"
const char* ssid = \" \";
const char* password = \" \";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
int dac = 0;
int DigitalPin[] = {4, 12, 13};
int DacPin = 5;
// Auxiliary variables to store selected mode and set
tings
int selectedMode = 0;
int timer = 0;
int ldrThreshold = 0;
int armMotion = 0;
int armLdr = 0;
String modes[4] = { \"Manual\", \"Auto PIR\", \"Auto LDR\", \"Auto PIR and LDR\" };
// Decode HTTP GET value
String valueString = \"0\";
int pos1 = 0;
int pos2 = 0;
// Variable to store the HTTP request
String header;
// Set web server port number to 80
void setup() {
Serial.begin(115200);
delay(10);
pinMode(4,INPUT);
pinMode(4, INPUT_PULLUP);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print(\"Connecting to \");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(\".\");
}
Serial.println(\"\");
Serial.println(\"WiFi connected\");
// Start the server
server.begin();
Serial.println(\"Server started\");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println(\"new client\");
while(!client.available()){
delay(1);
}
// Read the first line of the request
String command1 = client.readStringUntil(\'/\');
String command = client.readStringUntil(\'/\');
Serial.println(command1);
Serial.println(command);
client.println(\"
ESP8266 Web Server
\");
// Drop down menu to select mode
client.println(\"
Mode selected:\" + modes[selectedMode] + \"
\");
client.println(\"\");
client.println(\"Change mode\");
client.println(\"Manual\");
client.println(\"Auto PIR\");
client.println(\"Auto LDR\");
client.println(\"Auto PIR and LDR\");
0