Добрый день! Есть UNO, Ethernet shield, кнопка, реле, светодиод Хотел реализовать проект, где через кнопки на браузере и кнопки на ардуино можно управлять реле. Состояние реле должен отображаться на браузере. Но реле управляется только через кнопки на ардуино, а команды от кнопки на браузере не понимает. Помогите, пожалуйста! Ниже код Код (C++): #include <SPI.h> #include <Ethernet.h> #include <Bounce.h> byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x31 }; EthernetClient client; char server[] = "shdomm.000webhostapp.com"; // имя вашего сервера www.arduino.ru int buff=0; const int ledPin=8; int butt; int button = 2; int ledValue = HIGH; Bounce bouncer = Bounce(button,50); void setup() { Serial.begin(9600); Ethernet.begin(mac); pinMode(ledPin, OUTPUT); pinMode(button, INPUT); digitalWrite(ledPin, LOW); } void loop() { if (buff == 1) ledValue = HIGH; else if (buff == 2) ledValue = LOW; // Кнопка if(bouncer.update()) { if(bouncer.read() == HIGH) { if(ledValue == LOW) ledValue = HIGH; else ledValue = LOW; } } // Кнопка digitalWrite (ledPin, ledValue); if(ledValue == HIGH) butt = 1; else if(ledValue == LOW) butt = 2; if (client.connect(server, 80)) { client.print( "GET /add_data.php?"); client.print("button="); client.print(butt); client.println( " HTTP/1.1"); client.print( "Host: " ); client.println(server); client.println( "Connection: close" ); client.println(); client.println(); delay(500); while (client.available()){ char c = client.read(); Serial.print(c); if (c =='1') buff=1; else if (c =='2') buff=2; } client.stop(); client.flush(); delay(100); } else { client.stop(); delay(1000); client.connect(server, 80);} delay(500); } Код на сервере add_data.php PHP: <?php $S1 = $_GET['button']; $myFile1 = "txt/out-1.txt"; $fh1 = fopen($myFile1, 'w') or die("can't open file"); fwrite($fh1, $S1); fclose($fh1); $myFile = "txt/out-1.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo $theData; ?>