/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: ESP32 Control
- Source Code NOT compiled for: Arduino Nano ESP32
- Source Code created on: 2024-05-19 00:07:45
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* Présence des Objects */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include //https://github.com/greiman/SdFat
#include "ESP32_OV5640_AF.h" //https://github.com/0015/ESP32-OV5640-AF
/****** FUNCTION PROTOTYPES *****/
void updateOutputs(void); // Added function prototype for updateOutputs
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t myLCD1602_LCD1602_D4_PIN_D4 = 4;
const uint8_t myLCD1602_LCD1602_D5_PIN_D5 = 5;
const uint8_t myLCD1602_LCD1602_D6_PIN_D6 = 6;
const uint8_t myLCD1602_LCD1602_D7_PIN_D7 = 7;
/***** DEFINITION OF SPI PINS *****/
const uint8_t Bb_SDCardModule_SPI_PIN_MOSI_D11 = 11;
const uint8_t Bb_SDCardModule_SPI_PIN_MISO_D12 = 12;
const uint8_t Bb_SDCardModule_SPI_PIN_SCLK_D13 = 13;
const uint8_t Bb_SDCardModule_SPI_PIN_CS_D10 = 10;
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
bool myLCD1602_LCD1602_D4_PIN_D4_rawData = 0;
bool myLCD1602_LCD1602_D5_PIN_D5_rawData = 0;
bool myLCD1602_LCD1602_D6_PIN_D6_rawData = 0;
bool myLCD1602_LCD1602_D7_PIN_D7_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
float myLCD1602_LCD1602_D4_PIN_D4_phyData = 0.0;
float myLCD1602_LCD1602_D5_PIN_D5_phyData = 0.0;
float myLCD1602_LCD1602_D6_PIN_D6_phyData = 0.0;
float myLCD1602_LCD1602_D7_PIN_D7_phyData = 0.0;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
SdFs sd; // Instance of SdFs class from SdFat library
OV5640 ov5640; // Instance of OV5640 class from ESP32_OV5640_AF library
void setup()
{
pinMode(myLCD1602_LCD1602_D4_PIN_D4, OUTPUT);
pinMode(myLCD1602_LCD1602_D5_PIN_D5, OUTPUT);
pinMode(myLCD1602_LCD1602_D6_PIN_D6, OUTPUT);
pinMode(myLCD1602_LCD1602_D7_PIN_D7, OUTPUT);
pinMode(Bb_SDCardModule_SPI_PIN_CS_D10, OUTPUT);
SPI.begin();
sensor_t* sensor = esp_camera_sensor_get();
ov5640.start(sensor);
if (ov5640.focusInit() == 0) {
Serial.println("OV5640_Focus_Init Successful!");
}
if (ov5640.autoFocusMode() == 0) {
Serial.println("OV5640_Auto_Focus Successful!");
}
}
void loop()
{
updateOutputs(); // Refresh output data
}
void updateOutputs()
{
digitalWrite(myLCD1602_LCD1602_D4_PIN_D4, myLCD1602_LCD1602_D4_PIN_D4_rawData);
digitalWrite(myLCD1602_LCD1602_D5_PIN_D5, myLCD1602_LCD1602_D5_PIN_D5_rawData);
digitalWrite(myLCD1602_LCD1602_D6_PIN_D6, myLCD1602_LCD1602_D6_rawData);
digitalWrite(myLCD1602_LCD1602_D7_PIN_D7, myLCD1602_LCD1602_D7_rawData);
}
/* END CODE */