벌써 세번째 질문이네요, 자꾸만 죄송합니다.
페이지 정보
작성자 ukfine 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 작성일16-05-23 10:47 조회1,007회 댓글1건본문
미세먼지 센서 관련 스케치 올려주신거 보고 무작정 따라하면서 천천히 배워가고 있습니다.
답변도 친절하게 해주셔서 너무나 감사드립니다.
이게 아마 마지막 질문이 될거 같습니다.
이더넷모듈관련 스케치를 살펴보는데 이게 제가 이더넷모듈을 공유기에 달린 랜선에 하나 꼽고
작동시키는건 알겠는데, 서버에 전송되는 데이타값을 제가 확인하는 곳이 어디인지 모르겠습니다.
////////////////////////////////////////////////////// | |
// Ethernet functions | |
// Send data to remote server | |
char url_buf[113]; | |
void sendData() { | |
for(int i=0; i<113; i++) | |
url_buf[i] = 0x00; | |
String strUrl = "admin-ajax.php?action=bloter_extension_update_air_data&id=2974CD80-0A61-2DDF-4198-2F7E68A4D1F1&field1="; | |
strUrl += dtostrf(dustdensity, 5, 4, s); | |
strUrl.toCharArray(url_buf, 112); | |
url_buf[112] = 0x00; | |
ether.browseUrl(PSTR("/wp-admin/"), url_buf, website, my_callback); | |
//Serial.print(website); | |
//Serial.print("/wp-admin/"); | |
//Serial.println(url_buf); | |
} | |
// called when the client request is complete | |
static void my_callback (byte status, word off, word len) { | |
Ethernet::buffer[off+300] = 0; | |
showInfo(">>> Received", 3); | |
//showInfo((char*) Ethernet::buffer + off); | |
//delay(5000); | |
} | |
// Initialize ethernet module | |
void initialize_ethernet(void){ | |
for(;;){ // keep trying until you succeed | |
//Reinitialize ethernet module | |
//pinMode(5, OUTPUT); | |
//digitalWrite(5, LOW); | |
//delay(1000); | |
//digitalWrite(5, HIGH); | |
//delay(500); | |
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0){ | |
showInfo("Failed to access Ethernet controller", 3); | |
continue; | |
} | |
showInfo("Ethernet begin", 3); | |
if (!ether.dhcpSetup()){ | |
showInfo("DHCP failed", 3); | |
continue; | |
} | |
//ether.printIp("IP: ", ether.myip); | |
//ether.printIp("GW: ", ether.gwip); | |
//ether.printIp("DNS: ", ether.dnsip); | |
if (!ether.dnsLookup(website)) { | |
showInfo("DNS failed", 3); | |
delay(5000); | |
continue; | |
} | |
ether.printIp("SRV: ", ether.hisip); | |
showInfo("Ethernet initialized!!", 3); | |
delay(3000); | |
//reset init value | |
res = 0; | |
break; | |
} | |
} | |
올려주신 스케치중에 이더넷부분만 긁어왔습니다.
매번 죄송하고, 매번 감사드립니다..
댓글목록
최고관리자님의 댓글

아래 코드가 서버에 전송할 URL을 만드는 부분입니다.
String strUrl = "admin-ajax.php?action=bloter_extension_update_air_data&id=2974CD80-0A61-2DDF-4198-2F7E68A4D1F1&field1=";
strUrl += dtostrf(dustdensity, 5, 4, s)
URL에 action, id, field1 등의 변수를 넣어서 보내게됩니다.