OV2640 - Camera

The OV2640 Camera chip is a low voltage CMOS imagesensor that provides the full functionality of a single-chip UXGA (1632x1232 - 2 MegaPixel) camera and image processor.


1. Datasheet

OV2640-DATASHEET


2. snapshot()

2.1. Description

snapshot() returns an image.

2.2. Syntax

snapshot()

2.3. Returns

uint8_t* pixels - if pixels format is RGB565: return RGB565 pixels with every uint16_t one pixel, e.g. RED: 0xF800

2.4. Example Code

see example selfie

#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);
}

results matching ""

    No results matching ""