Hi, i've read a few threads with no real suggestion how fix my current problem:
According to the datasheet of the Wiznet Ethernet Shield (http://arduino.cc/en/Main/ArduinoEthernetShield) it supports up to four simultanios connections.
So my idea was to build the following:
Web-Server (controling arduino - running in void loop())
Pachube Client (receives Data through XBEE)
UDP Client (NTP Sync every 12 Hours)
I was able to get the web-server running.
I've also found some pachube-clients - one works well.
To get NTP i've also figured out a few - and got it running.
Combinend to on 18k program it doesn't even get through setup()....
#include <SPI.h>
#include <Ethernet.h>
#include <Udp.h>
#include <TextFinder.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <NewSoftSerial.h>
// Network
byte mac[] = {0xDE,0xAD, 0xBE,0xEF,0xFE,0xED};
byte ip[] = { 192,168,0,177 };
byte subnet[] = {255,255,255,0};
byte gateway[] = {192,168,0,1};
byte pachube[] = {173,203,98,29};
Server server(80);
//Client client(pachube, 80);
// NTP Time stuff
unsigned int localPort = 8888;
byte timeServer[] = { 192,53,103,108 };
const int NTP_PACKET_SIZE= 48;
byte packetBuffer[ NTP_PACKET_SIZE];
// NewSoftSerial
uint8_t pin_in = 2, pin_out = 3;
NewSoftSerial mySerial(pin_in, pin_out);
// XBee
const byte startbyte = 0x7E;
const byte RemoteAT = 0x17;
const byte ApplyChanges = 0x02;
// Runtime-Variables
boolean delayrun = false;
// Pachube-Stuff
float xbee_temp_01 = 0;
float xbee_light_01 = 0;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
//Serial.println("Serial Ports");
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Udp.begin(localPort);
// Initial Tasks
Alarm.timerOnce(15, getNTP);
// Daily Tasks
Alarm.alarmRepeat(18,10,0, getNTP);
Alarm.alarmRepeat(5,10,0, getNTP);
Alarm.alarmRepeat(23,59,40, endofday);
// Repeating Tasks
Alarm.timerRepeat(60, RepeatTask);
// Timers for prog
Alarm.alarmRepeat(20,0,0, prog1_an_timerless);
Alarm.alarmRepeat(20,10,0, prog_aus);
Alarm.alarmRepeat(20,10,2, prog2_an_timerless);
Alarm.alarmRepeat(20,20,2, prog_aus);
Serial.println("Setup done");
}
I've also raised the number of available Timers in TimeAlarms.h to #define dtNBR_ALARMS 20 so that i can have plenty alarms.
Anybody have an idea, how to fix this??