Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <HTTPClient.h>
- #include <processData.h>
- #include <Ethernet.h>
- #include <Controllino.h>
- #include <TimeLib.h>
- //ETHERNET SETTINGS
- #define SERVER_UPDATE_TIMEOUT 5000 // Send data every x ms
- byte ip[] = { 192, 168, 42, 30 }; // This ip address is coupled to the mac address in the router!
- //byte server[] = { 192, 168, 42, 10 };
- char server = "192.168.42.25";
- byte dnsServer[] = { 8, 8, 8, 8 };
- byte gateway[] = { 192, 168, 42, 1 };
- byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // This mac address is coupled to the ip address in the router!
- byte subnet[] = {255,255,255,0};
- #define TIME_GMTOFFSET -2 // Offset to correct for time
- EthernetClient client;
- processData processor = processData(client);
- void setup() {
- //Serial1 is XBee, connected on pin 18 and 19 on Controllino
- Serial1.begin(115200); //XBee/UART1/pins 0 and 1
- Serial.begin(115200); //USB
- Serial.println("Test program for communicating to webserver");
- //Initialize ethernet connection on Controllino
- Ethernet.begin(mac, ip);
- //RTC
- Controllino_RTC_init(0); // Initialize RTC pins
- setTime((int)Controllino_GetHour() + TIME_GMTOFFSET,(int)Controllino_GetMinute(), (int)Controllino_GetSecond(), (int)Controllino_GetDay(), (int)Controllino_GetMonth(), (int)Controllino_GetYear()); // setup time library to later generate UNIX timestapm
- }
- void loop() {
- //Check for incoming data from XBee
- while (Serial1.available() > 0) {
- //Logic statement to seperate incoming data
- //from sending XBee with sensors
- processor.storeData( Serial1.readString());
- // String restData = Serial1.readString();
- delay(500);
- }//while
- // Serial1.flush();
- // Serial.flush();
- // delay(500);
- }//void loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement