Using array of hex with println.

I’m using UIPEthernet.

I want to use gzip method for an html page. I first gzipped using 7-zip then used this : File to hex converter

However, it doesn’t work out well cause my code is wired to display the page using client.println

When I try

const unsigned char hexvalues[] = {0x1F, 0x8B, 0x08, 0x08, 0x90, 0xC2, 0x4B, 0x5F, 0x04, 0x00, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6E, 0x6F, 0x2E, 0x68, 0x74, 0x6D, 0x6C, 0x00, 0x25, 0x8D, 0xDD, 0x6A, 0xC2, 0x30, 0x18, 0x86, 0xCF, 0x07, 0xBB, 0x87, 0xD0, 0x1D, 0x64, 0x3F, 0xD8, 0xCE, 0x83, 0xC1, 0xD6, 0x7D, 0xCD, 0xD8, 0x4F, 0x06, 0x05, 0xAD, 0xA2, 0xF5, 0x02, 0xDA, 0x24, 0x6A, 0x30, 0xE6, 0x93, 0xF8, 0x45, 0xA8, 0xE2, 0xBD, 0xAB, 0xF4, 0xEC, 0xE5, 0x85, 0xE7, 0x79, 0xA0, 0x2E, 0xEB, 0x91, 0x14, 0x15, 0x9F, 0xB3, 0x99, 0x1C, 0x4F, 0x6A, 0x09, 0x59, 0xFF, 0x40, 0x1B, 0x04, 0xEC, 0xA9, 0x73, 0x46, 0xB4, 0xA8, 0xBB, 0x53, 0xDB, 0xA8, 0xCD, 0x2A, 0x60, 0xF4, 0x7A, 0xA0, 0xD0, 0x61, 0xC8, 0x1F, 0xDE, 0xFE, 0x3F, 0xE4, 0xF7, 0xEB, 0xE7, 0xF9, 0xF9, 0xB4, 0x44, 0x4F, 0x83, 0xBD, 0x3D, 0x9A, 0x7C, 0xF8, 0xBE, 0xA3, 0x33, 0x64, 0x3D, 0x07, 0xEB, 0xA1, 0x90, 0x9E, 0x4C, 0x60, 0xD3, 0x5F, 0x56, 0xFE, 0xE5, 0x0C, 0xAC, 0xDF, 0x45, 0x62, 0x56, 0x17, 0x09, 0x25, 0x82, 0x41, 0x1B, 0x89, 0xD0, 0x33, 0xF4, 0xCA, 0x59, 0xB5, 0x29, 0x12, 0x87, 0xAA, 0x21, 0x8B, 0x3E, 0x5D, 0x07, 0xB3, 0x2C, 0xF8, 0x17, 0x7F, 0xD1, 0xA8, 0xE2, 0xD6, 0x78, 0x4A, 0x57, 0x86, 0xA4, 0x33, 0xB7, 0xF9, 0xD3, 0x95, 0xFA, 0x91, 0x13, 0x7F, 0x4A, 0x0F, 0x8D, 0x8B, 0x26, 0x11, 0xF5, 0x62, 0x56, 0xB1, 0x49, 0x05, 0x59, 0xAF, 0x13, 0x90, 0x5D, 0xBB, 0xF7, 0x77, 0x17, 0xE5, 0xBE, 0x9E, 0xC4, 0xDA, 0x00, 0x00, 0x00};
client.println(hexvalues);

no matching function for call to 'println(const unsigned char [225])'

When I try

client.println({0x1F, 0x8B, 0x08, 0x08, 0x90, 0xC2, 0x4B, 0x5F, 0x04, 0x00, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6E, 0x6F, 0x2E, 0x68, 0x74, 0x6D, 0x6C, 0x00, 0x25, 0x8D, 0xDD, 0x6A, 0xC2, 0x30, 0x18, 0x86, 0xCF, 0x07, 0xBB, 0x87, 0xD0, 0x1D, 0x64, 0x3F, 0xD8, 0xCE, 0x83, 0xC1, 0xD6, 0x7D, 0xCD, 0xD8, 0x4F, 0x06, 0x05, 0xAD, 0xA2, 0xF5, 0x02, 0xDA, 0x24, 0x6A, 0x30, 0xE6, 0x93, 0xF8, 0x45, 0xA8, 0xE2, 0xBD, 0xAB, 0xF4, 0xEC, 0xE5, 0x85, 0xE7, 0x79, 0xA0, 0x2E, 0xEB, 0x91, 0x14, 0x15, 0x9F, 0xB3, 0x99, 0x1C, 0x4F, 0x6A, 0x09, 0x59, 0xFF, 0x40, 0x1B, 0x04, 0xEC, 0xA9, 0x73, 0x46, 0xB4, 0xA8, 0xBB, 0x53, 0xDB, 0xA8, 0xCD, 0x2A, 0x60, 0xF4, 0x7A, 0xA0, 0xD0, 0x61, 0xC8, 0x1F, 0xDE, 0xFE, 0x3F, 0xE4, 0xF7, 0xEB, 0xE7, 0xF9, 0xF9, 0xB4, 0x44, 0x4F, 0x83, 0xBD, 0x3D, 0x9A, 0x7C, 0xF8, 0xBE, 0xA3, 0x33, 0x64, 0x3D, 0x07, 0xEB, 0xA1, 0x90, 0x9E, 0x4C, 0x60, 0xD3, 0x5F, 0x56, 0xFE, 0xE5, 0x0C, 0xAC, 0xDF, 0x45, 0x62, 0x56, 0x17, 0x09, 0x25, 0x82, 0x41, 0x1B, 0x89, 0xD0, 0x33, 0xF4, 0xCA, 0x59, 0xB5, 0x29, 0x12, 0x87, 0xAA, 0x21, 0x8B, 0x3E, 0x5D, 0x07, 0xB3, 0x2C, 0xF8, 0x17, 0x7F, 0xD1, 0xA8, 0xE2, 0xD6, 0x78, 0x4A, 0x57, 0x86, 0xA4, 0x33, 0xB7, 0xF9, 0xD3, 0x95, 0xFA, 0x91, 0x13, 0x7F, 0x4A, 0x0F, 0x8D, 0x8B, 0x26, 0x11, 0xF5, 0x62, 0x56, 0xB1, 0x49, 0x05, 0x59, 0xAF, 0x13, 0x90, 0x5D, 0xBB, 0xF7, 0x77, 0x17, 0xE5, 0xBE, 0x9E, 0xC4, 0xDA, 0x00, 0x00, 0x00});

no matching function for call to 'UIPClient::println(<brace-enclosed initializer list>)'

I’m only trying this to save some space. Is it worth it? Can i achieve it?

 virtual size_t write(const uint8_t *buf, size_t size);
client.println(*hexvalues,sizeof(hexvalues));

client.println(&hexvalues,sizeof(hexvalues));

The first one prints a single 's' char. 2nd one doesn't work.

I think you want:

client.write(hexvalues,sizeof hexvalues);

Thanks much, that worked. Didn't have the effect I expected. At least I can sleep now.

woistmeinauto:
I’m only trying this to save some space. Is it worth it? Can i achieve it?

Is this related to your other post, where you are using an UNO? If so, you can free up some ram by storing the data in flash memory:

const unsigned char hexvalues[] PROGMEM = {0x1F, 0x8B, 0x08, 0x08, 0x90, 0xC2, 0x4B, 0x5F, 0x04, 0x00, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6E, 0x6F,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8D, 0x8B, 0x26, 0x11, 0xF5, 0x62, 0x56, 0xB1, 0x49, 0x05, 0x59, 0xAF, 0x13, 0x90, 0x5D, 0xBB, 0xF7, 0x77, 0x17, 0xE5, 0xBE, 0x9E, 0xC4, 0xDA, 0x00, 0x00, 0x00};

//use this code to retrieve the data from PROGMEM
for (unsigned int i = 0; i < sizeof(hexvalues); i ++) {
  client.write(pgm_read_byte(&hexvalues[i]));
}

Another alternative it so use the F() macro to store the text in the client.println() statements in flash memory

          client.println(F("HTTP/1.1 200 OK")); //send new page
          client.println(F("Content-Type: text/html"));

Hi, thanks for your suggestions. I wish I saw that earlier, I'm already using F macro for all strings atm.

However, right now I'm struggling with the PROGMEM byte arrays for MAC addresses. They display differently.

I'll try adding your code for that. Thanks again.

Edit: Yeah, works. Now my project is complete, will update my post sometime.