Pages: [1]   Go Down
Author Topic: Storing Image in ROM and sending it by ethernet  (Read 674 times)
0 Members and 1 Guest are viewing this topic.
Brazil
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Xano
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I know, sounds bad ... but I cannot use SD.
The image is 4kb. I made a Java program that creates an array with the values ​​of the image. But when I try to send by ethernet, the Arduino stop (I guess it overload the memory somehow). How make the compiler use directly the ROM, not RAM memory?

Code:
PROGMEM prog_uchar uniscImage[] = {71, 73, 70, 56, 57, 97, 222, 0, 53, 0, 112, 0, 0, 33, 249, 4, 1, 0, 0, 252, 0, 44, 0, 0, 0, 0, 222, 0, 53, 0, 135, 0, 0, 0, 0, 0, 51, 0, 0, 102, 0, 0, 153, 0, 0, 204, 0, 0, 255, 0, 43, 0, 0, 43, 51, 0, 43, 102, 0, 43, 153, 0, 43, 204, 0, 43, 255, 0, 85, 0, 0, 85, 51, 0, 85, 102, 0, 85, 153, 0, 85, 204, 0, 85, 255, 0, 128, 0, 0, 128, 51, 0, 128, 102, 0, 128, 153, 0, 128, 204,
0, 128, 255, 0, 170, 0, 0, 170, 51, 0, 170, 102, 0, ............<4kb>.......... , 175, 83, 83, 64, 128, 193, 21, 207, 235, 50, 35, 196, 18, 215, 155, 23, 229, 57, 115, 54, 242, 6, 64, 96, 31, 197, 65, 56, 154, 48, 115, 209, 224, 60, 201, 81, 126, 180, 59, 26, 75, 25, 20, 174, 183, 15, 223, 193, 129,
238, 22, 10, 184, 102, 69, 152, 209, 176, 140, 123, 156, 208, 80, 108, 108, 199, 187, 68, 225, 122, 224, 148, 179, 26, 131, 191, 9, 144, 153, 42, 99, 147, 36, 164, 49, 69, 145, 175, 95, 87, 186, 117, 164, 12, 8, 75, 26, 36, 182, 20, 141, 49, 30, 120, 170, 175, 22, 242, 166, 91, 197, 87, 39, 165, 100, 193, 106, 19, 253, 70, 98, 218, 231, 193, 36, 129, 93, 56, 112, 186, 41, 177, 181, 108, 228, 88, 110, 91, 54, 12, 129, 61, 8, 80, 64, 1, 1, 0, 59
};


Code:
   client.println("HTTP/1.0 200 OK");

   client.println("Content-Type: image/gif");
   client.println();
   for(x=0; x<sizeof(uniscImage); x++) {
      client.write(uniscImage[x]);
   }

Thanks smiley-wink
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26465
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How make the compiler use directly the ROM, not RAM memory?
Use PROGMEM
http://www.arduino.cc/en/Reference/PROGMEM
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Brazil
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
Xano
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How make the compiler use directly the ROM, not RAM memory?
Use PROGMEM
http://www.arduino.cc/en/Reference/PROGMEM

Ok, thanks smiley-wink
Logged

Pages: [1]   Go Up
Jump to: