 #include <VirtualWire.h>   
 
 const byte receive_pin = 4;
-
 byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
 IPAddress myIp(192, 168, 1, 150);
 IPAddress serverIp(192, 168, 1, 134);

  Udp.begin(2345);
  
  Serial.begin(9600);
  
  //uncomment to reset EEPROM counter
  //EEPROM.write(0, 0);  EEPROM.write(1, 0);  EEPROM.write(2, 0);  EEPROM.write(3, 0);

    
        //encrypt and sign
        byte srclen = strlen((char*)padded);
        byte padnum = 16 - (srclen % 16);
        memset(padded+srclen, padnum, padnum);
        int paddedLen = srclen + padnum;

        memset(packet+56, 0, 16);
        packet[56] = counter & 0xFF;
        packet[57] = (counter & 0xFF00) >> 8;
        packet[58] = (counter & 0xFF0000) >> 16;
        packet[59] = (counter & 0xFF000000) >> 24;
        cbcaes256.clear();
        cbcaes256.setKey(key, 32);
        cbcaes256.setIV((uint8_t *)(packet+56), 16);
        memcpy(packet, "IOT\0", 4);
        packet[36] = 1;
        packet[37] = 1;
        packet[38] = 0;
        packet[39] = 0;
        memcpy(packet+40, deviceId, 16);
        cbcaes256.encrypt(((uint8_t*)packet)+72, (uint8_t*)padded, paddedLen);
        int len = 72+paddedLen;
        sha256.resetHMAC(key, 32);
