ESP-01 (meu primeiro IOT).
Autor: Sineir Marcos | Publicado: 2015-10-02T19:09:00-07:00

Codigo adaptado do livro&nbsp;Internet of thinks with EPS8266.
Carregado direto pela IDE Arduino 1.6.5
Montei um script PHP com autenticação que gerencia um pequeno arquivo texto com a lista dos perifericos, e com uns botões on/off para alterar seus valores. O conteudo é semelhante ao da lista abaixo:
MyDevice1@1
MyDevice2@0
MyDevice3@1
MyDimmer1@155
MyDimmer2@254
MyTemp1@25
MyTemp2@45

Funcionamento Script PHP:

Passando o usuario e senha, retorna a lista de todos os devices e valores(como acima):
xxxxxx.php?usuario=joaodasilva&amp;password=suasenha

Passando um device retorna só o seu valor:
xxxxxx.php?usuario=joaodasilva&amp;password=suasenha&amp;MyDevice1

Passando o device e um valor, grava o valor passado:
xxxxxx.php?usuario=joaodasilva&amp;password=suasenha&amp;MyDevice1=1

Codigo alterado (parte do credito ao autor).
/***************************************************
Written by Marco Schwartz for Open Home Automation. 
BSD license, all text above must be included in any redistribution
Based on the original sketches supplied with the ESP8266/Arduino
implementation written by Ivan Grokhotkov &nbsp; &nbsp; 
****************************************************/
// Libraries
#include 
// WiFi parameters
const char* ssid = "nome_rede_wifi";
const char* password = "senha_rede_wifi";
//esp-01 só tem dois IOs (exceto serial)
#define lamp1 0
#define lamp2 2
// Host
const char* host = "seu.site.com.br";

void setup() {
&nbsp; // Start Serial
&nbsp; Serial.begin(115200);
&nbsp; delay(10);
&nbsp; pinMode ( lamp1, OUTPUT );
&nbsp; pinMode ( lamp2, OUTPUT ); 

&nbsp; // We start by connecting to a WiFi network
&nbsp; Serial.println();
&nbsp; Serial.println();
&nbsp; Serial.print("Connecting to ");
&nbsp; Serial.println(ssid);
&nbsp; WiFi.begin(ssid, password);
&nbsp; while (WiFi.status() != WL_CONNECTED) {
&nbsp; &nbsp; delay(500);
&nbsp; &nbsp; Serial.print(".");
&nbsp; }

&nbsp; Serial.println("");
&nbsp; Serial.println("WiFi connected"); 
&nbsp; Serial.println("IP address: ");
&nbsp; Serial.println(WiFi.localIP());
}

void loop() {

&nbsp; Serial.print("Connecting to ");
&nbsp; Serial.println(host);

&nbsp; // Use WiFiClient class to create TCP connections
&nbsp; WiFiClient client;
&nbsp; const int httpPort = 80;
&nbsp; if (!client.connect(host, httpPort)) {
&nbsp; &nbsp; Serial.println("connection failed");
&nbsp; &nbsp; return;
&nbsp; }

&nbsp; // This will send the request to the server
&nbsp; //+ String(h) &amp;devlamp1=
&nbsp; client.print(String("GET /SuaPastaScript/xxxxxx.php?usuario=") &nbsp;+ " HTTP/1.1\r\n" +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Host: " + host + "\r\n" +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"Connection: keep-alive\r\n\r\n");
&nbsp; &nbsp; delay(1000);
&nbsp; // Read all the lines of the reply from server and print them to Serial
&nbsp; while(client.available()){
&nbsp; &nbsp; String line = client.readStringUntil('\r');
&nbsp; &nbsp; if(line.indexOf("MyDevice1@1") != -1){
&nbsp; &nbsp; &nbsp; &nbsp;digitalWrite ( lamp1, 1 );
&nbsp; &nbsp; &nbsp; &nbsp;Serial.println("lamp1 on");
&nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp;if(line.indexOf("MyDevice1@0") != -1){
&nbsp; &nbsp; &nbsp; &nbsp;digitalWrite ( lamp1, 0 );
&nbsp; &nbsp; &nbsp; &nbsp;Serial.println("lamp1 off"); &nbsp; &nbsp; 
&nbsp; &nbsp; }
&nbsp; &nbsp; if(line.indexOf("MyDevice2@1") != -1){
&nbsp; &nbsp; &nbsp; &nbsp;digitalWrite ( lamp2, 1 );
&nbsp; &nbsp; &nbsp; &nbsp;Serial.println("lamp2 on");
&nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp;if(line.indexOf("MyDevice2@0") != -1){
&nbsp; &nbsp; &nbsp; &nbsp;digitalWrite ( lamp2, 0 );
&nbsp; &nbsp; &nbsp; &nbsp;Serial.println("lamp2 off"); &nbsp; &nbsp; 
&nbsp; &nbsp; } &nbsp; 
&nbsp; }
&nbsp; Serial.println();
&nbsp; Serial.println("closing connection");
&nbsp; // Repeat every 10 seconds
&nbsp; delay(1000);
}

/*******************************************************/