-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathelse_arduino.ino
63 lines (52 loc) · 1.35 KB
/
else_arduino.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <Arduino.h>
#include <ESP32QRCodeReader.h>
#include "esp_camera.h"
#include "driver/rtc_io.h"
ESP32QRCodeReader reader(CAMERA_MODEL_AI_THINKER);
camera_config_t config;
void onQrCodeTask(void *pvParameters)
{
struct QRCodeData qrCodeData;
while (true)
{
if (reader.receiveQrCode(&qrCodeData, 100))
{
Serial.println("Found QRCode");
if (qrCodeData.valid)
{
Serial.print("Payload: ");
Serial.println((const char *)qrCodeData.payload);
}
else
{
Serial.print("Invalid: ");
Serial.println((const char *)qrCodeData.payload);
}
}
vTaskDelay(100 / portTICK_PERIOD_MS);
}
}
void setup()
{
Serial.begin(115200);
Serial.println();
config.pixel_format = PIXFORMAT_JPEG;
if(psramFound()){
config.frame_size = FRAMESIZE_UXGA; // FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
config.jpeg_quality = 10; //10-63 lower number means higher quality
config.fb_count = 2;
}else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
reader.setup();
Serial.println("Setup QRCode Reader");
reader.beginOnCore(1);
Serial.println("Begin on Core 1");
xTaskCreate(onQrCodeTask, "onQrCode", 4 * 1024, NULL, 4, NULL);
}
void loop()
{
delay(1000);
}