전체상품목록 바로가기

본문 바로가기


현재 위치
  1. home
  2. community
  3. 기술문의 :)

기술문의 :)

기술문의 게시판 입니다.

상품 게시판 상세
subject 문제점 정보...
writer 유일남 (ip:)
  • date 2014-03-14 13:23:25
  • like 추천하기
  • view 31
rating 0점

 안녕하세요 요청하신 자료에 대한 답변.


1. 안드로이드스케치(SW) 버젼 : 1.0.5-r2


2. 멕어드레스에 대한 답변.

동시에 3개를 설치한 것이 아닌, 이더넷 쉴드W5200을 교체하면서 테스트.


3. 사용 소스


#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,177);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
   client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("<br />");      
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}

file
password 삭제하려면 비밀번호를 입력하세요.
댓글 수정

password :

/ byte

비밀번호 : 확인 취소

댓글 입력

commentsname : password : 관리자 답변 보기

/ byte

왼쪽의 문자를 공백없이 입력하세요.(대소문자구분)

회원에게만 댓글 작성 권한이 있습니다.

관련 글 보기

관련글 모음
번호 상품명 제목 작성자 작성일 조회
12321 단종 - 제품사용문제 미취급 [TE91000PSLD] 아두이노 이더넷 쉴드 E형 (W5200 Ethernet Shield) 이더넷 실드 연결 문제 이부형 2014-11-04 5
12329 단종 - 제품사용문제 미취급 [TE91000PSLD] 아두이노 이더넷 쉴드 E형 (W5200 Ethernet Shield) 이더넷 실드 연결 문제 아트로봇 2014-11-05 8
12436 단종 - 제품사용문제 미취급 [TE91000PSLD] 아두이노 이더넷 쉴드 E형 (W5200 Ethernet Shield) 이더넷 실드 연결 문제 이부형 2014-11-11 8
12599 단종 - 제품사용문제 미취급 [TE91000PSLD] 아두이노 이더넷 쉴드 E형 (W5200 Ethernet Shield) 이더넷 실드 연결 문제 아트로봇 2014-11-20 3
11362 단종 - 제품사용문제 미취급 [TE91000PSLD] 아두이노 이더넷 쉴드 E형 (W5200 Ethernet Shield) 안녕하세요 문의드립니다. 이진해 2014-08-20 115