Hello and thanks for the example, but I am having problems sending a message to wunderground.com with this code.
If I put on the navigation tab "weatherstation.wunderground.com/weatherstation/updateweatherstation.php?ID=MIAMIA&PASSWORD=pepito&dateutc=2019-01-17+15%3A27%3A08&tempf=60&humidity=56"
everything is correct and the server receives the information (I also use httplib.HTTPConnection () in python and everything is correct), but I can not do it with VARIABLE. I tried all combinations of PATH and VARIABLE, removed spaces, etc.
Of course, I can get the IP and DNS is working fine and connect to the server.
Could you help me? Thank you
Put all the code if you have an idea of ββthe Stash function.
Thanks in advance.
#include <EtherCard.h> // ethernet interface mac address, must be unique on the LAN byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; const char website[] PROGMEM = "weatherstation.wunderground.com"; byte Ethernet::buffer[700]; uint32_t timer; Stash stash; void setup () { Serial.begin(57600); Serial.println("\n[webClient]"); if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller"); if (!ether.dhcpSetup()) Serial.println("DHCP failed"); ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); if (!ether.dnsLookup(website)) Serial.println("DNS failed"); ether.printIp("SRV: ", ether.hisip); } void loop () { ether.packetLoop(ether.packetReceive()); if (millis() > timer) { timer = millis() + 10000; byte sd = stash.create(); stash.print("/weatherstation/updateweatherstation.php? ID=I******&PASSWORD=********&dateutc=2019-01- 17+17%3A47%3A02&tempf=52&humidity=70"); stash.save(); // generate the header with payload - note that the stash size is used, // and that a "stash descriptor" is passed in as argument using "$H" Stash::prepare(PSTR("GET /update HTTP/1.1" "\r\n" "Host: $F" "\r\n" "Connection: close" "\r\n" "Content-Type: text/plain; charset=utf-8" "\r\n" "Content-Length: $D" "\r\n" "\r\n" "$H"), website, PSTR(""), stash.size(), sd); // send the packet - this also releases all stash buffers once done ether.tcpSend(); Serial.println("Mandado"); } }
source share