Created
April 28, 2015 10:43
-
-
Save kuc-arc-f/8ce48f913bc4a93e2bda to your computer and use it in GitHub Desktop.
agri-blog5-1a-arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int iSen =0; | |
int iSen2=0; | |
int iSen3=0; | |
int iSen4=0; | |
iSen =analogRead(SENSOR); | |
iSen2 =analogRead(SENSOR_1); | |
iSen3 =analogRead(SENSOR_2); | |
iSen4 =analogRead(SENSOR_3); | |
if (Ethernet.begin(mac) == 0) { | |
Serial.println("Failed to configure Ethernet using DHCP"); | |
Ethernet.begin(mac, ip); | |
} | |
delay(1000); | |
String sSen = String(iSen); | |
String sSen2 = String(iSen2); | |
String sSen3 = String(iSen3); | |
String sSen4 = String(iSen4); | |
//MC_ID | |
Serial.println("===== request ====="); | |
Serial.println("SEN_1=" + sSen ); | |
Serial.println("connecting..."); | |
String sHost ="Host: "; | |
sHost.concat(server); | |
if (client.connect(server, 80)) { | |
Serial.println("connected"); | |
String sReq= "GET /trans.php?mc_id="; | |
sReq.concat(MC_ID); | |
sReq.concat("&rkey="); | |
sReq.concat(mRestKey); | |
sReq.concat("&apkey="); | |
sReq.concat(mAppKey); | |
sReq.concat("&snum_1="); | |
sReq.concat(sSen); | |
sReq.concat("&snum_2="); | |
sReq.concat(sSen2); | |
sReq.concat("&snum_3="); | |
sReq.concat(sSen3); | |
sReq.concat("&snum_4="); | |
sReq.concat(sSen4); | |
sReq.concat(" HTTP/1.1"); | |
Serial.println(sReq); | |
client.println(sReq); | |
client.println( sHost ); | |
client.println("Connection: close"); | |
client.println(); | |
mNOW_CONE =true; | |
} | |
else { | |
Serial.println("connection failed"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment