Ir ao conteúdo
  • Cadastre-se

Caminhão Piri Truck

Membro Júnior
  • Posts

    1
  • Cadastrado em

  • Última visita

Reputação

0
  1. olá a todos . tenho um problema com html. esse projeto funciona perfeitamente no navegador do computador . gostaria que esse botão funciona no navegador do celular . pois no navegador do celular não funciona abaixo o codigo. #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address byte ip[] = { 192, 168, 1, 18 }; // ip in lan byte gateway[] = { 192, 168, 1, 1 }; // internet access via router byte subnet[] = { 255, 255, 255, 0 }; //subnet mask EthernetServer server(80); //server port String readString; const int ledPin = 8; int buttonState0 = 0; int buttonState1 = 0; void setup(){ pinMode(8, OUTPUT); //pin selected to control //start Ethernet Ethernet.begin(mac, ip, gateway, gateway, subnet); server.begin(); //enable serial data print Serial.begin(9600); Serial.println("server multi pin button test 1.0"); // so I can keep track of what is loaded } void loop(){ // Create a client connection EthernetClient client = server.available(); if (client) { while (client.connected()) { if (client.available()) { char c = client.read(); //read char by char HTTP request if (readString.length() < 100) { //store characters to string readString += c; //Serial.print(c); } //if HTTP request has ended if (c == '\n') { /////////////// Serial.println(readString); //print to serial monitor for debuging client.println("HTTP/1.1 200 OK"); //send new page client.println("Content-Type: text/html"); client.println(); client.println("<HTML>"); client.println("<HEAD>"); client.println("<TITLE>Arduino</TITLE>"); client.println("</HEAD>"); client.println("<BODY>"); client.println("<H1><center>ARDUINO WEB BUTTON</center></H1>"); client.println("<br>"); // custom buttons client.print("<table align='center' border=10 bgcolor='green' ><th><h2><div onmousedown='mDown(this)' onmouseup='mUp(this)' style='background-color:'#D94A38';width:130px;height:30px;padding:10px;'>-0-</div></table>>"); client.println("<script>function mDown(obj){obj.style.backgroundColor='#1ec5e5';obj.innerHTML='ACESO';location.href='?ON'}function mUp(obj){obj.style.backgroundColor='#D94A38';obj.innerHTML='APAGADO';location.href='?OFF'}</script>>"); client.println("</BODY>"); client.println("</HTML>"); delay(1); //stopping client client.stop(); buttonState0 = readString.indexOf('ON') >0; buttonState1 = readString.indexOf('OFF') >0; if (buttonState0 == HIGH) { digitalWrite(ledPin, HIGH); } if (buttonState1 == HIGH){ digitalWrite(ledPin, LOW); } //clearing string for next read readString=""; } } } } }

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!