10 years, 7 months ago.

send image through

I want to send a Jpeg image (I'm using a JPEG camera) to my pc through Ethernet. I already know how to get the image and my Ethernet communication is working well. I'm having the trouble because the send_all of the Ethernet receives array in char and the format of the generated image is in uint8_t.

I'm trying to convert but it's been 4 days without success

thank you in advance,

1 Answer

10 years, 7 months ago.

Without having done anything like that myself, if that is the only issue it is easy to solve: Simply add (char*) in front of the name of the variable you are sending. This tells the compiler explicitly to convert from uint8_t pointer (array is a pointer) to char pointer. Since a char is pretty much an uint8_t this is not a problem.

Accepted Answer

thank you very much for your solution!

I was really going to implement that but, I got deeper problem. I created a project for the camera (works well), and another one to the ethernet (great). I don't know why when I try to use the two libraries my mbed stop working. I think it's pretty simple to check (if you download the jpegcamera example and add the ethernet library) you will problem get the same problem,

have you ever tried it?

  1. include "mbed.h"
  2. include "JPEGCamera.h"
  3. include "EthernetInterface.h" DigitalOut fail(LED4); DigitalOut ok(LED1);

EthernetInterface eth; TCPSocketConnection socket;

int main() { eth.init(); Use DHCP eth.connect();

JPEGCamera camera(p13, p14); TX, RX LocalFileSystem local("local"); Timer timer; timer.start(); camera.setPictureSize(JPEGCamera::SIZE320x240); while (socket.connect("192.168.0.100", 666) < 0) { }

kind regards, Bruno

posted by Bruno Leme 12 Apr 2014

For sure use <<code>> and <</code>> around your code for proper formatting here.

Also if you publish your program I can easily import it and try it out, although right now I don't have my LPC1768 available. I wonder if it might run out of memory. You can use the code here for example to check how much is left: https://mbed.org/forum/bugs-suggestions/topic/4809/ (not that this specific one won't free the memory afterwards, so you can only check how much memory is left at a certain spot in your program, then it stops executing).

From my tests adding on top:

 #pragma import __use_two_region_memory

gives you around 4kB extra of memory before it crashes, might be enough, might not be enough.

posted by Erik - 12 Apr 2014