sexta-feira, 24 de fevereiro de 2023

Controle WEB Mini System Sony

 

                           Controle de Mini System Sony pela internet


 Controle seus aparelhos de som da Sony pelo celular

Faça por conta e risco...


Pesquisei sobre o protocolo SIRC da Sony, daí clonei um controle pela entrada do microfone no pc com o programa Audacity (Melhor que osciloscópio)...


          Neste caso, Start  0000 1100 1011 1001 1100 em HEX: CB9C  comando: - <<

Foi utilizado a IDE do arduino, para programar um ESP32, na GPIO 26 utilizar um led IR com resistor de 120 ohms para proteção da saída, utiliza metade da corrente do led, pois o pino está limitado à 12mA e não 20mA que o led precisa, distância funcional sem drive 50 cm.


Página do servidor que está no ESP32

Programa completo:


// Base do protocolo Sony consultada em https://www.sbprojects.net/knowledge/ir/sirc.php

/*

Aparelho testado HCD-SH2000 100% funcional, extra o comando Eject

100% Compatível com os modelos de controle:

- RM-AMU006 / RM-AMU053 / RM-SC3 / RM-SCU37B

Aparelhos compatíveis: Não testados :)

MHC-GTR6 / CMT-LX10R 

CMT-FX200 / FST-SH2000

MHC-EC590 / / MHC-GTZ3

GTR33 / GTR888

MHC-EC599 / MHC-ESX6

MHC-ESX8 / MHC-ESX9

MHC-EX66 /MHC-EX88

MHC-EX99 / GTR555

HCD-ZUX9 / FST-ZUX9

HCD-GTX66 / MHC-GTX66

HCD-GTX77 / MHC-GTX77

HCD-GTX88 / MHC-GTX88

HCD-GTX787 / MHC-GTX787

HCD-GTX888 / MHC-GTX888

HCD-EX6 / MHC-EX6

HCD-EX8 / MHC-EX8

HCD-EC68 / MHC-EC68

HCD-GT22 / MHC-GT22

HCD-GT44 / MHC-GT44

HCD-GT111 / MHC-GT111

HCD-GT222 / MHC-GT222

HCD-GT444 / MHC-GT444

HCD-GT555 / MHC-GT555

HCD-EX660 / MCH-EX660

HCD-EX880 / MHC-EX880

 */

#include <WiFi.h>

unsigned long previousMillis = 0; 

unsigned long interval = 30000;

#define D1 26

#define CONNECT_TIME 10000

#define TIMEOUTTIME 5000


const char* ssid = "Sua rede aqui";

const char* password = "Senha da rede aqui";

WiFiServer server(80);


size_t currentTime = millis();

size_t previousTime = 0;

String header;


void setup() {

pinMode(D1, OUTPUT);

WiFi.begin(ssid, password);

server.begin();

}


void loop() {

WiFiClient client = server.available();

if (client) {

currentTime = millis();

previousTime = currentTime;

String currentLine = "";

unsigned long currentMillis = millis(); 

if ((WiFi.status() != WL_CONNECTED) && (currentMillis - previousMillis >=interval)) {

WiFi.disconnect();

//WiFi.reconnect();

previousMillis = currentMillis;}

while (client.connected() && currentTime - previousTime <= TIMEOUTTIME) {currentTime = millis();

if (client.available()) {char c = client.read();header += c;

if (c == '\n') {if (currentLine.length() == 0) {

client.println("<br />");

client.println("<h1 style=\"text-align:center; \" class=\"display-4\"><font color='Gold'><i><u>Controle Mini System Sony</u></i></h1> "); 


if (header.indexOf("GET /D1/on") >= 0) { // power ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: POWER</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();zero();um();zero();um();zero();zero();zero();zero();zero();zero();um();delay(45);}} //code 0xA81 POWER ON/OFF 101010000001


else if (header.indexOf("GET /D2/on") >= 0) { //sleep ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: SLEEP</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();zero();zero();zero();zero();zero();um();um();zero();zero();zero();zero();um();delay(45);}} //code 0x061   Sleep 0000 0110 0001


else if (header.indexOf("GET /D3/on") >= 0) { // display ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Crimson'>State: DISPLAY</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();um();zero();um();zero();zero();um();zero();zero();zero();zero();um();delay(45);}} //END code 0xD21  Display 110100100001


else if (header.indexOf("GET /D4/on") >= 0) { // vol + ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: VOL +</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();zero();um();zero();zero();um();zero();zero();zero();zero();zero();zero();um();delay(45);}} //code 0x481  VOL + 010010000001


else if (header.indexOf("GET /D5/on") >= 0) { // vol - ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: VOL -</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();um();um();zero();zero();um();zero();zero();zero();zero();zero();zero();um();delay(45);}} //code 0xC81 Vol - 110010000001


else if (header.indexOf("GET /D6/on") >= 0) { // play ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: PLAY</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();zero();um();zero();zero();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x4CB9C  01001100101110011100   


else if (header.indexOf("GET /D7/on") >= 0) { // stop ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: STOP</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();zero();zero();zero();um();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x1CB9C 0001 1100 1011 1001 1100


else if (header.indexOf("GET /D8/on") >= 0) { //set clock ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: SELECT (clock)</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();zero();um();zero();zero();zero();um();um();zero();zero();zero();zero();um();delay(45);}} //code 0x461


else if (header.indexOf("GET /D13/on") >= 0) { //tunner / band ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: TUNER/BAND</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();um();um();um();um();zero();zero();zero();zero();zero();zero();zero();um();delay(45);}} //code 0xF01 111100000001


else if (header.indexOf("GET /D10/on") >= 0) { //pause ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State:PAUSE</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();um();zero();zero();um();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x9CB9C  1001 1100 1011 1001 1100       


else if (header.indexOf("GET /D11/on") >= 0) { //cd ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: CD</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();um();zero();um();zero();zero();um();zero();zero();zero();zero();zero();um();delay(45);}} //code 0xA41 1010 0100 0001


else if (header.indexOf("GET /D12/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Cyan'>State: USB</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();zero();um();zero();um();um();zero();zero();zero();zero();zero();zero();um();zero();zero();um();delay(45);}} //code 0x2C09 010 1100 0000 1001


else if (header.indexOf("GET /D9/on") >= 0) { // eq ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='RED'>State: EQ</MARQUEE></2></i>"); 

for (int i = 0; i < 3; i++){start();um();um();zero();zero();zero();um();um();zero();zero();zero();zero();um();zero();zero();um();delay(45);}} //code 0x6309 110 0011 0000 1001


else if (header.indexOf("GET /D14/on") >= 0) { //function ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: FUNCTION</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();zero();zero();um();zero();um();um();zero();zero();zero();zero();um();zero();zero();um();delay(45);}} //code 0x4B09   100 1011 0000 1001                                                                           


else if (header.indexOf("GET /D15/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: - << </MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();zero();zero();zero();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0xCB9C  00001100 1011 1001 1100


else if (header.indexOf("GET /D16/on") >= 0) { // + >> ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: + >> </MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();zero();zero();zero();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x8CB9C 1000 1100 1011 1001 1100                                                                           


else if (header.indexOf("GET /D17/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: ENTER</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();zero();um();um();um();um();um();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x3EB9C  0011 1110 1011 1001 1100                                                                           


else if (header.indexOf("GET /D18/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: SET (clock)</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();zero();um();zero();zero();um();um();zero();zero();zero();zero();um();delay(45);}} //code 0xA61  101001100001                                                                          


else if (header.indexOf("GET /D19/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: << </MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();um();zero();zero();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0xCCB9C  1100 1100 1011 1001 1100                                                                        


else if (header.indexOf("GET /D20/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: >> </MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();zero();um();zero();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x2CB9C 0010 1100 1011 1001 1100                                                                        


else if (header.indexOf("GET /D21/on") >= 0) { // eject ok

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: EJECT</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();zero();um();um();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x3CB9C  0011 1100 1011 1001 1100


else if (header.indexOf("GET /D22/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: REPEAT / FM mode</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();zero();um();um();zero();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0xB4B9C  1011 0100 1011 1001 1100                                                                           


else if (header.indexOf("GET /D23/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: Tuner Memory</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();um();um();um();zero();zero();zero();zero();zero();zero();zero();um();delay(45);}} //code 0x701  0111 0000 0001                                                                         


else if (header.indexOf("GET /D24/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: Play M / Tuner M</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();zero();zero();um();zero();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x14B9C  0001 0100 1011 1001 1100                                                                          


else if (header.indexOf("GET /D25/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: CLEAR</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();um();um();um();zero();zero();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0xF0B9C 1111 0000 1011 1001 1100                                                                           


else if (header.indexOf("GET /D26/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: Disc Skip / USB Select</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();um();um();um();um();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x7CB9C 0111 1100 1011 1001 1100                                                                          


else if (header.indexOf("GET /D27/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: Folder -</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();zero();um();um();um();zero();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0x74B9C 0111 0100 1011 1001 1100                                                                           


else if (header.indexOf("GET /D28/on") >= 0) { //

client.println("<h2 style=\"text-align:center; \" class=\"display-4\"><i><MARQUEE BEHAVIOR=SCROLL WIDTH=30%><font color='Gold'>State: Folder +</MARQUEE></2></i>");

for (int i = 0; i < 3; i++){start();um();um();um();um();zero();um();zero();zero();um();zero();um();um();um();zero();zero();um();um();um();zero();zero();delay(45);}} //code 0xF4B9C  1111 0100 1011 1001 1100                                                                           


client.println("<!DOCTYPE html><html>");

client.println("<head><meta name=\"viewport\" content=\"width=device-width(); initial-scale=1\">");

client.println("<meta charset=\"UTF-8\">");

client.println("<title>Controle Mini System Sony</title>");

client.println("<link rel=\"icon\" href=\"data:,\">");

client.println("<style> { font-family: Helvetica; display: inline-block; margin: 3px auto; text-align: center;}");

client.println(".mybtn { background-color: #4CAF50; border: 3px solid #4CAF50;border-radius:50px;; color: white; padding: 10px 15px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer; }");

client.println(".par { font-size: 16px;}"); 

client.println("p {text-align: center;}");

client.println("</style></head>"); 

client.println("<body style=background-color:#000000>"); 

client.println("<body class=\"bg-light\">");

client.println("<center><table>");

client.println("<td><p><a href=\"/D13/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">TUNER/BAND</a></p></td>");

client.println("<td><p><a href=\"/D14/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">FUNCTION</a></p></td>");

client.println("<tr>");

client.println("<td><p><a href=\"/D1/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #DC143C!important; color:#f8f9fa!important;\" >POWER</a></p></td>");

client.println("<td><p><a href=\"/D2/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">SLEEP</a></p></td>");         

client.println("<td><p><a href=\"/D3/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">DISPLAY</a></p></td>");        

client.println("<td><p><a href=\"/D4/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">VOL +</a></p></td>");

client.println("<tr>");      

client.println("<td><p><a href=\"/D5/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">VOL -</a></p></td>");      

client.println("<td><p><a href=\"/D6/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">PLAY</a></p></td>"); 

client.println("<td><p><a href=\"/D7/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">STOP</a></p></td>");         

client.println("<td><p><a href=\"/D8/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">SELECT (clock)</a></p></td>");          

client.println("</tr>");

client.println("<tr>");     

client.println("<td><p><a href=\"/D9/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">EQ</a></p></td>");

client.println("<td><p><a href=\"/D10/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">PAUSE</a></p></td>");

client.println("<td><p><a href=\"/D11/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">CD</a></p></td>");  

client.println("<td><p><a href=\"/D12/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">USB</a></p></td>");

client.println("</tr>"); 

client.println("<tr>");     

client.println("<td><p><a href=\"/D15/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\"> - << </a></p></td>");

client.println("<td><p><a href=\"/D16/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\"> + >> </a></p></td>");

client.println("<td><p><a href=\"/D17/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">ENTER</a></p></td>");  

client.println("<td><p><a href=\"/D18/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">SET (clock)</a></p></td>");

client.println("</tr>");

client.println("<tr>");     

client.println("<td><p><a href=\"/D19/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\"> << </a></p></td>");

client.println("<td><p><a href=\"/D20/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\"> >> </a></p></td>");

client.println("<td><p><a href=\"/D21/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">EJECT</a></p></td>");  

client.println("<td><p><a href=\"/D22/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">REPEAT / FM mode</a></p></td>");

client.println("</tr>");

client.println("<tr>");     

client.println("<td><p><a href=\"/D23/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\"> Tuner Memory </a></p></td>");

client.println("<td><p><a href=\"/D24/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\"> Play Mode / tuner Mode</a></p></td>");

client.println("<td><p><a href=\"/D25/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">CLEAR</a></p></td>");  

client.println("<td><p><a href=\"/D26/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">Disc skip / USB select</a></p></td>");

client.println("</tr>");

client.println("<tr>");     

client.println("<td><p><a href=\"/D27/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">Folder -</a></p></td>");

client.println("<td><p><a href=\"/D28/on\" role=\"button\" class=\" mybtn btn btn-success mybtn\"style=\"background-color: #198754!important; color:#f8f9fa!important;\">Folder +</a></p></td>");

client.println("</tr>");                                                                

client.println("</div>");

client.println("</body></html></div></form></table></center>");

client.println();

break;} else {

currentLine = "";}} 

else if (c != '\r') {

currentLine += c;}}}

header = ""; 

client.stop();}

delay(1);}


// Aqui controle dos bits 1, 0 e start gerando a portadora em 40KHZ

void um(){

for (int i = 0; i < 47; i++){   //48  |--|_  48x25=1200/600

   digitalWrite(D1, HIGH);

   delayMicroseconds(12.5);// 12.5uS

   digitalWrite(D1, LOW);

   delayMicroseconds(12.5);} //12.5uS}

   //digitalWrite(D1, LOW);

   delayMicroseconds(600); }//600uS}}

void zero(){

for (int i = 0; i < 23; i++){  //24   |-|_    24x25=600/600

   digitalWrite(D1, HIGH);

   delayMicroseconds(12.5); //12.5uS

   digitalWrite(D1, LOW);

   delayMicroseconds(12.5);} //12.5uS}

  // digitalWrite(D1, LOW);

   delayMicroseconds(600);} //600uS}}

void start(){

for (int i = 0; i < 95; i++){   //96    |----|_  96x25=2400/600

   digitalWrite(D1, HIGH);

   delayMicroseconds(12.5); //12.5uS

   digitalWrite(D1, LOW);

   delayMicroseconds(12.5);} //12.5uS}

   delayMicroseconds(600);} //600uS}}







Nenhum comentário:

Postar um comentário