yes, i know i now placed the string constants between F().
leaving me with these output readings
Sketch uses 17.372 bytes (56%) of program storage space. Maximum is 30.720 bytes.
Global variables use 1.297 bytes (63%) of dynamic memory, leaving 751 bytes for local variables. Maximum is 2.048 bytes.
and this is the final sketch, some more things to do but so far so good.
// Demo using DHCP and DNS to perform a web client request.
// 2011-06-08 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#include <EtherCard.h>
#include <OneWire.h>
#include <DallasTemperature.h>
char payload[50];
void(* resetFunc) (void) = 0; //declare reset function @ address 0
// ethernet interface mac address, must be unique on the LAN
// and other stuff used for the network interface
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[700];
char website[] PROGMEM = "82.72.232.147";//destination website
// Stuff used for one wire sensors
// Data wire is plugged into pin 7 on the Arduino
#define ONE_WIRE_BUS 7
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int temp1;
int temp2;
// Some random stuff used in this program
static uint32_t timer;
byte wd_counter;
// called when the client request is complete
static void my_callback (byte status, word off, word len) {
Ethernet::buffer[off+300] = 0;
// get_reply_data gets the data part of the reply and puts it in the line_buf char a
// Controleer of de data juist is ontvangen.
if (strcmp((const char*) Ethernet::buffer,"HTTP/1.1 200 OK"))
{
wd_counter=0;
Serial.println( F(" recieved ok."));
} else
{
Serial.println( F(" !!! ERROR !!!."));
Serial.println( F(">>>"));
Serial.print((const char*) Ethernet::buffer+off);
Serial.println( F("<<<"));
}
}
//Setup the board
void setup () {
//Start serial port
Serial.begin(9600);
Serial.println( F("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"));
Serial.println( F("\nNANO EMONCMS Temperatuur sender\n\n\n"));
//Start ethernet port
if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0)
Serial.println( F("Failed to access Ethernet controller"));
//Get own ip adress
if (!ether.dhcpSetup())
Serial.println( F("DHCP failed"));
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
//Look ip destination website
if (!ether.dnsLookup(website))
Serial.println( F("DNS failed"));
ether.printIp("SRV: ", ether.hisip);
// Startup one wire sensors
sensors.begin();
}
// Main program
void loop () {
ether.packetLoop(ether.packetReceive());
if (wd_counter>=10) {
Serial.println( F("Resetting device"));
resetFunc();
}
if (millis() > timer) {
wd_counter++;
timer = millis() + 25000;
Serial.println(" ");
Serial.print( F("Attempt number "));
Serial.print(wd_counter);
Serial.print( F(" of 10, data send to emoncms: "));
sensors.requestTemperatures();
temp1 = round(sensors.getTempCByIndex(0)*10);
temp2 = round(sensors.getTempCByIndex(1)*10);
sprintf(payload,"{Temp_buiten_camping:%d,Temp_binnen_camping:%d}",temp1,temp2);
Serial.print(payload);
ether.browseUrl(PSTR("/emoncms/input/post.json?apikey=913f557706d069745bfe8dac70040261&json="), payload, website, my_callback);
}
}