sipeed / Maixduino

Arduino port on Maix board ( k210 )
https://maixduino.sipeed.com
Other
213 stars 93 forks source link

RE: Trying the Given Selfie Source/Maixduino Selfie Source! #115

Closed silver2row closed 2 years ago

silver2row commented 3 years ago

Hello,

I got the LCD to work on the Maixduino. This is neat. Anyway, I cannot get the camera to snap photos due to this line:

Sipeed_OV2640 camera(FRAMESIZE_QVGA, PIXFORMAT_RGB565);

The error was due to Sipeed_OV2640 not allowing camera to call it.

The source follows:

#include <Sipeed_OV2640.h>
#include <Sipeed_ST7789.h>

SPIClass spi0(SPI0); // MUST be SPI0 for Maix series on board LCD
Sipeed_ST7789 lcd(320, 240, spi0);

Sipeed_OV2640 camera(FRAMESIZE_QVGA, PIXFORMAT_RGB565);

void setup()
{
    Serial.begin(115200);

    lcd.begin(15000000, COLOR_RED);
    // lcd.invertDisplay(true); // comment this out when camera is on the backside

    Serial.print("camera init ");
    if(!camera.begin())
      Serial.println("failed");
    else
      Serial.println("success");
    camera.run(true);
}

void loop()
{
  uint8_t* img = camera.snapshot();
  if (img == nullptr || img == 0)
    Serial.println("snap failed");
  else
    lcd.drawImage(0, 0, camera.width(), camera.height(), (uint16_t*)img);
}

You can see right before void setup(), there is the line in question. I keep receiving errors due to this line. Does anyone know how to make the camera module onboard the Maixduino work?

Seth

silver2row commented 3 years ago

Hello,

Does this source work w/ the Arduino IDE or do I need to have a SD Card to handle the files?

Seth

P.S. If I need the files on SD Card to handle the "Selfie" camera module source, where is a good starter point for looking at how to handle SD Cards on the Maixduino?