Hi! I have 1 pin, how to add 2 more pins ![]()
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 };
IPAddress ip(191,11,1,1);
// ????????????? ?????????? ??????????:
EthernetClient client;
// ???????? ????? ?????????
const int requestInterval = 2000;
// URL ???????, ???????? ????? ?????????? ???????
char serverName[] = "***";
// ?????? ?? ?????? ????? ???????????
boolean requested;
// ????? ? ???????????? ? ?????????? ??????????? ? ???????
long lastAttemptTime = 0;
// ?????? ??? ?????????? ?????? ? ???????
String currentLine = "";
// ?????? ??? ????????
String text = "";
// ?????????? ?????? ?????????: ??????? ?? ????? ??????
boolean readingtext = false;
void setup() {
 pinMode(13, OUTPUT);
 pinMode(11, OUTPUT);
 // ??????????? ????? ??? ??????:
 currentLine.reserve(256);
 text.reserve(150);
 // ????????????? ????????????????? ?????:
 Serial.begin(9600);
 // ??????? ??????????? ? DHCP:
 if (!Ethernet.begin(mac)) {
  // ???? DHCP-?????? ??????????? ? ????, ???????????? ? ???????? ???? IP-???????:
  Ethernet.begin(mac, ip);
 }
 // ???????????? ? ???????r:
 connectToServer();
}
void loop()
{
 if (client.connected()) {
  if (client.available()) {
   // ????????? ?????????? ?????:
   char inChar = client.read();
   // ????????? ?????????? ????? ? ????? ??????:
   currentLine += inChar;
   // ???? ??????? ?????? ????? ??????, ??????? ??????????:
   if (inChar == '\n') {
    currentLine = "";
   }
   // ???? ??????? ?????? ????????????? ????????? , ??????
   // ?????? ????? ????????? ??????????????? ????? ?????:
   if ( currentLine.endsWith("<pin13>")) {
    // ?????? ?????? ?????. ??????? ?????????? tweet:
    readingtext = true;
    text = "";
   }
   // ???? ?????? ?????????? ?????????? ?????? ?????,
   // ????????? ?? ? ????????? ?????????? tweet:
   if (readingtext) {
    if (inChar != '<') {
     text += inChar;
    }
    else {
     // ???? ??? ??????? ?????? "<",
     // ?????? ?? ???????? ????? ?????:
     readingtext = false;
     Serial.println(text);
     if(text == ">1"){
     digitalWrite(13, HIGH);
     Serial.println("13 on");
     }
     if(text != ">1"){
     digitalWrite(13, LOW);
     Serial.println("13 off");
     }
     // ??????????? ?? ???????:
     client.stop();
    }
   }
  }
 }
 else if (millis() - lastAttemptTime > requestInterval) {
  // ???? ?? ? ?????? ?????? ?? ?????????? ? ???????
  // ? ?????? 2 ?????? ? ??????? ?????????? ???????????, ???????
  // ??????????? ????? ? ????????? ????????? ?????????????? ????:
  connectToServer();
 }
}
// ??????? ??????????? ? ??????? Twitter:
void connectToServer() {
 Serial.println("connecting to server...");
 if (client.connect(serverName, 80)) {
  Serial.println("making HTTP request...");
 // ??????? GET HTTP-?????? ? ????????:
  client.println("GET /data.xml HTTP/1.1");
  client.println("HOST: ***");
  client.println();
 }
 // ?????????? ? ?????????? ????? ??????? ??????? ??????????:
 lastAttemptTime = millis();
}