adafruit / Adafruit-VC0706-Serial-Camera-Library

Library for VC0706-based Serial JPEG Cameras
http://www.adafruit.com/products/397
136 stars 110 forks source link

VC0706 with node mcu #20

Open rahimmaham opened 6 years ago

rahimmaham commented 6 years ago

can we use node mcu instead of arduino board to capture image through vc0706 and send it to server ?

treii28 commented 5 years ago

I'm currently trying to get this to work on ESP8266 with spiffs, but the manner in which the examples assign the incoming data to an unbounded uint8_t array seems to crash the espressif chip whenever I try to do a write. Shouldn't any 'buffer' array value be passed in as a pointer, and populated rather than trying to do an assignment?

Referring to the following lines from the example:

    uint8_t *buffer;
    uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
    buffer = cam.readPicture(bytesToRead);
    imgFile.write(buffer, bytesToRead);

imgFile.write() crashes the esp8266. The readPicture file returns the internal buffer pointer in the object. Shouldn't the function be asking for a pointer coming in, and populating it internally before exiting? I'm new to C++ but most of the stuff I've read says don't try to pass a pointer out of an external function as it's unpredictable. (can be subject to garbage collection for example)