arduino ethernet auto post need HELP!!
hi! use arduino ethernet , real time module ds3231.
i need send request server every 60s. not working:s use in ethernet web server
code:
i send data in readds3231 method time forks fine but data not send:s
i need send request server every 60s. not working:s use in ethernet web server
code:
code: [select]
#include <spi.h>
#include <ethernet.h>
#include <ds3231.h>
#include <wire.h>
byte mac[] = {0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed};
ipaddress ip(192,168,1,177);
ds3231 clock;
bool century=false;
bool h12;
bool pm;
byte aday, ahour, aminute, asecond, abits;
bool ady, a12h, apm;
int siurblys = 0, = 0;
string readstring = string(30), readstring1;
double tempc = 0, dregn = 0;
int yourarduinodata = 999;
string yourdatacolumn = "yourdata=";
string yourdata;
ethernetserver server(80);
void setup() {
wire.begin();
clock.setsecond(1);
ethernet.begin(mac, ip);
server.begin();
serial.begin(9600);
}
void loop() {
// listen incoming clients
ethernetclient client = server.available();
if (client) {
serial.println("new client");
boolean currentlineisblank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
readstring += c;
serial.write(c);
if (c == '\n' && currentlineisblank) {
client.println("http/1.1 200 ok");
client.println("content-type: text/html");
client.println("connection: close"); // connection closed after completion of response
client.println();
processcheckbox(client);
test();
client.println("grab({");
client.println("\"temperatura\":");
client.println(temp());
client.println(",\"dregnumas\":");
client.println(dreg());
client.println(",\"siurblys\":");
client.println(siurblys);
client.println("})");
readstring = "";
break;
}
if (c == '\n') {
// you're starting new line
currentlineisblank = true;
}
else if (c != '\r') {
// you've gotten character on current line
currentlineisblank = false;
}
}
}
delay(1);
client.stop();
serial.println("client disonnected");
}
readds3231();
}
void readds3231(){
int second;
second=clock.getsecond();
if(second == 0){
serial.println("issiusta");
ethernetclient client;
client.println("get /search?q=arduino http/1.1");
client.println("host:192.168.1.103");
client.println("connection: close");
client.println();
delay(1000);
}
}
i send data in readds3231 method time forks fine but data not send:s
Arduino Forum > Using Arduino > Programming Questions > arduino ethernet auto post need HELP!!
arduino
Comments
Post a Comment