hey guys
i'm working on a project with Arduino nano+enc28j60 module.
this is my code:
static byte mymac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x31 };
byte Ethernet::buffer[700];
static uint32_t timer;
const char website[] PROGMEM = "example.com";
Stash stash;
static byte session;
int ok = ether.begin(sizeof Ethernet::buffer, mymac, 10); // default pin:10
if (ok) Serial.println("ethernet started");
else {
Serial.println("failed start ethernet");
return;
}
const static uint8_t ip[] = {192, 168, 10, 2};
const static uint8_t gw[] = {192, 168, 10, 1};
const static uint8_t dns[] = {8, 8, 8, 8};
const static uint8_t mask[] = {255, 255, 255, 0};
if (ether.staticSetup(ip, gw, dns, mask))
Serial.println(F("ip config ok"));
else
Serial.println(F("ip config err"));
byte sd = stash.create();
stash.save();
Stash::prepare(PSTR("GET http://$F/api?action=attendance HTTP/1.0" "\r\n"
"Host: $F" "\r\n"
"Content-Length: $D" "\r\n"
"Connection: close" "\r\n"
"User-Agent: Arduino/1.0" "\r\n"
"\r\n"
"$H"),
website, website, stash.size(), sd);
session = ether.tcpSend();
// get response
const char* reply = ether.tcpReply(session);
if (reply != 0) {
Serial.println("Got a response!");
Serial.println(reply);
}
the web request successfully send and i can get the request from server, but response (reply variable) is empty.
i'm sure that the server response back a 'hello world text'
please help me.
tnx