机器人代码例程:
web 页面控制机器人
/**
第四课 web 页面控制机器人
*/
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#include <LobotServoControllerS.h>
SoftwareSerial swSer(14, 12, false, 256);//rx,tx,
LobotServoController myse(swSer);
const char* ssid = "aap";
const char* password = "18888804";
// Set web server port number to 80
WiFiServer server(80);
String header;// Variable to store the HTTP request
String output4State = "off";
String Cmd = "stop"; //控制命令
const int output4 = D4;
void setup() {
swSer.begin(9600);
Serial.begin(115200);
while (!Serial);
pinMode(output4, OUTPUT);// Initialize the output variables as outputs
digitalWrite(output4, LOW); // Set outputs to LOW
// Connect to Wi-Fi network with SSID and password
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);