ARDUINO-HTML Encender Un Led
ARDUINO-HTML Encender Un Led
ARDUINO-HTML Encender Un Led
<!doctype html>
<img src="https://scontent.fpbc1-2.fna.fbcdn.net/v/t34.0-
12/18763240_1344547262266444_1361534406_n.png?oh=54876028d45dd1aa11
fdb19ec51fff6e&oe=59709A25"alt="TEC"width=10% height=10%
align="Right">
<img src="http://tecuruapan.edu.mx/redfocitec/Logos/11.png"alt="TEC"width=10%
height=10% align="left">
<h2>Alumnos:</h2>
<style type="text/css">
body{
background-image: url(https://encrypted-
tbn0.gstatic.com/images?q=tbn:ANd9GcSm-yF50AUlrs4L7fakeQ1-
P2CloSBPQ96W7UrZ39JzV3MOm_2VSUoWim0);
background-position : center;
background-repeat : no-repeat;
background-attachment : fixed;
background-size: cover;
-moz-background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
</style>
<!--En la siguiente linea nos redireccionara a /LED=T, tipo de boton(envio)) ON-->
Circuito:
Cdigo ARDUINO:
String state=String(3);
void setup() {
pinMode(PIN_LED,OUTPUT);
digitalWrite(PIN_LED,LOW);
state="OFF";
void loop() {
if(cliente) {
boolean lineaenblanco=true;
while(cliente.connected()) {
if(cliente.available()) {
char c=cliente.read();
if(readString.length()<30) {
readString.concat(c);
//Cliente conectado
if(readString.substring(LED,LED+5)=="LED=T") {
digitalWrite(PIN_LED,HIGH);
state="ON"; }
else if (readString.substring(LED,LED+5)=="LED=F") {
digitalWrite(PIN_LED,LOW);
state="OFF";
cliente.println("Content-Type: text/html");
cliente.println("<html>");
cliente.println("<head>");
cliente.println("<title>LED ON/OFF</title>");
cliente.println("</head>");
cliente.println("<center>");
cliente.println("<h1>LED ON/OFF</h1>");
cliente.print("<br><br>");
cliente.print(state);
cliente.print("<br><br><br><br>");
cliente.println("</center>");
cliente.println("</body>");
cliente.println("</html>");
cliente.stop();
readString="";
}
}