  */
 
 #include <SPI.h>
-#include <SD.h>
 #include <Ethernet.h>
 #include <EEPROM.h>
 #include <avr/eeprom.h>
 
-// comment/uncomment to disable/enable debug
-//#define DEBUG
-
-// comment/uncomment to disable/enable ethernet support
-#define NOETH
-
-#define RELAY_PIN 2
-
-#ifdef DEBUG
-#define DBG if(1) 
-#else
-#define DBG if(0) 
-#endif
-
-// Feed id
-long FEED = 0;
-// Cosm key
-char KEY[] = "-";
+#define APIKEY        "foo"                               // replace your Xively api key here
+#define FEEDID        0                                   // replace your feed ID
+
+#define RELAYPIN      2
+#define CURRENTPIN    A0
+#define VOLTAGEPIN    A1
 
 // Energino parameters
 int R1 = 100;

    randomSeed(analogRead(0));
    settings.mac[i] = random(0, 255);
  }
#endif
}

void setup() {
  // Set serial port
  Serial.begin(115200); 
  // Default on
  pinMode(RELAY_PIN,OUTPUT);
  digitalWrite(RELAY_PIN, LOW);
  // Loading setting 
  eeprom_read_block((void*)&settings, (void*)0, sizeof(settings));
  if (strcmp(settings.magic, MAGIC) != 0) {

      settings.port = value;
    }
  }   
  else {
    int value = atoi(inputBytesPtr);
    if (value < 0) {
