Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 97e2afe

Browse files
refactored examples layout
1 parent 1a36fd9 commit 97e2afe

File tree

9 files changed

+144
-10
lines changed

9 files changed

+144
-10
lines changed

‎deprecated/examples/Apple_vs_Orange/camera_pins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@
9494
#define PCLK_GPIO_NUM 22
9595

9696
#else
97-
#error "Camera model not selected"
97+
#error "CameraMotionDetection model not selected"
9898
#endif

‎deprecated/examples/ESP32CameraNaiveMotionDetection/camera_pins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@
9494
#define PCLK_GPIO_NUM 22
9595

9696
#else
97-
#error "Camera model not selected"
97+
#error "CameraMotionDetection model not selected"
9898
#endif

‎deprecated/src/eloquentarduino/vision/camera/pins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@
9696
#define PCLK_GPIO_NUM 22
9797

9898
#else
99-
#error "Camera model not selected"
99+
#error "CameraMotionDetection model not selected"
100100
#endif

‎examples/Camera/CameraCaptureExample/CameraCaptureExample.ino renamed to ‎examples/CameraMotionDetection/CameraCaptureExample/CameraCaptureExample.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void setup() {
3030
delay(4000);
3131
Serial.begin(115200);
3232

33-
// comment out if you want to increase the acquisition frequency
33+
// turn on high frequency capturing
3434
// in the case of OV767x camera, highFreq = 5 fps instead of 1 fps
3535
// in the case of Esp32 camera, highFreq clock = 20 MHz instead of 10 MHz
3636
camera.setHighFreq();
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* Camera motion detection + JPEG capture demo
3+
*/
4+
5+
#include "eloquent.h"
6+
#include "eloquent/vision/image/gray/custom.h"
7+
#include "eloquent/vision/motion/naive.h"
8+
#include "eloquent/fs/spiffs.h"
9+
10+
11+
// uncomment based on your camera and resolution
12+
13+
//#include "eloquent/vision/camera/ov767x/gray/vga.h"
14+
//#include "eloquent/vision/camera/ov767x/gray/qvga.h"
15+
//#include "eloquent/vision/camera/ov767x/gray/qqvga.h"
16+
//#include "eloquent/vision/camera/esp32/aithinker/gray/vga.h"
17+
//#include "eloquent/vision/camera/esp32/aithinker/gray/qvga.h"
18+
//#include "eloquent/vision/camera/esp32/aithinker/gray/qqvga.h"
19+
//#include "eloquent/vision/camera/esp32/wrover/gray/vga.h"
20+
//#include "eloquent/vision/camera/esp32/wrover/gray/qvga.h"
21+
//#include "eloquent/vision/camera/esp32/wrover/gray/qqvga.h"
22+
//#include "eloquent/vision/camera/esp32/eye/gray/vga.h"
23+
//#include "eloquent/vision/camera/esp32/eye/gray/qvga.h"
24+
//#include "eloquent/vision/camera/esp32/eye/gray/qqvga.h"
25+
//#include "eloquent/vision/camera/esp32/m5/gray/vga.h"
26+
//#include "eloquent/vision/camera/esp32/m5/gray/qvga.h"
27+
//#include "eloquent/vision/camera/esp32/m5/gray/qqvga.h"
28+
//#include "eloquent/vision/camera/esp32/m5wide/gray/vga.h"
29+
//#include "eloquent/vision/camera/esp32/m5wide/gray/qvga.h"
30+
//#include "eloquent/vision/camera/esp32/m5wide/gray/qqvga.h"
31+
32+
33+
#define THUMB_WIDTH 32
34+
#define THUMB_HEIGHT 24
35+
36+
// allocate memory to store the thumbnail into a new image
37+
Eloquent::Vision::Image::Gray::CustomWithBuffer<THUMB_WIDTH, THUMB_HEIGHT> thumbnail;
38+
Eloquent::Vision::Motion::Naive<THUMB_WIDTH, THUMB_HEIGHT> detector;
39+
40+
41+
void setup() {
42+
delay(4000);
43+
Serial.begin(115200);
44+
filesystem.begin(true);
45+
46+
// turn on high freq for fast streaming speed
47+
camera.setHighFreq();
48+
49+
if (!camera.begin()) {
50+
while (true) {
51+
Serial.println(camera.getErrorMessage());
52+
delay(1000);
53+
}
54+
}
55+
else {
56+
Serial.println("Camera init OK");
57+
}
58+
59+
detector.throttle(10);
60+
detector.setIntensityChangeThreshold(15);
61+
detector.setPixelChangesThreshold(0.1);
62+
}
63+
64+
65+
void loop() {
66+
if (!camera.capture()) {
67+
Serial.println(camera.getErrorMessage());
68+
delay(1000);
69+
return;
70+
}
71+
72+
// perform motion detection on resized image for fast detection
73+
// but keep original image for capture at full resolution
74+
camera.image.resizeTo<THUMB_WIDTH, THUMB_HEIGHT>(thumbnail);
75+
detector.update(thumbnail);
76+
77+
// if motion is detected, save original image as jpeg
78+
if (detector.isMotionDetected()) {
79+
auto file = filesystem.writeBinary("/capture_best.jpg");
80+
auto jpeg = camera.image.jpeg().bestQuality();
81+
82+
if (jpeg.writeTo(file)) {
83+
Serial.print("Best quality jpeg file size in bytes: ");
84+
Serial.print(file.size());
85+
Serial.print(". It took ");
86+
Serial.print(jpeg.getElapsedTime());
87+
Serial.println(" micros to encode");
88+
}
89+
else {
90+
Serial.print("Jpeg error: ");
91+
Serial.println(jpeg.getErrorMessage());
92+
}
93+
}
94+
}

‎examples/Camera/CameraMotionDetectionExample/CameraMotionDetectionExample.ino renamed to ‎examples/CameraMotionDetection/CameraMotionDetectionExample/CameraMotionDetectionExample.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void setup() {
6363

6464
// trigger motion when at least 10% of pixels change intensity by
6565
// at least 15 out of 255
66-
detector.setIntensityChangeThreshold(15);
6766
detector.setPixelChangesThreshold(0.1);
67+
detector.setIntensityChangeThreshold(15);
6868
}
6969

7070

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* WiFi scanner example
3+
* Print WiFi hotspots with their RSSI in Json format
4+
*
5+
* Enter the name of the location to start scanning
6+
* Enter 'stop' to stop the scanning
7+
*/
8+
9+
// replace with WiFiNINA.h if you use a different board
10+
#include "WiFi.h"
11+
12+
#include "eloquent.h"
13+
#include "eloquent/networking/wifi/WifiScanner.h"
14+
15+
16+
String location;
17+
18+
19+
void setup() {
20+
Serial.begin(115200);
21+
delay(2000);
22+
Serial.println("Instructions:");
23+
Serial.println("\tEnter the name of the location to start scanning");
24+
Serial.println("\tEnter 'stop' to stop scanning");
25+
}
26+
27+
void loop() {
28+
// await user to input his current location or "stop" to abort scanning
29+
if (Serial.available()) {
30+
location = Serial.readStringUntil('\n');
31+
}
32+
33+
// if a location is set, perform scan
34+
if (location != "" && location != "stop") {
35+
Serial.print(location);
36+
Serial.print(": ");
37+
wifiScanner.printAsJson(Serial);
38+
delay(2000);
39+
}
40+
}

‎library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "git",
77
"url": "https://github.com/eloquentarduino/EloquentArduino"
88
},
9-
"version": "2.0.1",
9+
"version": "2.0.2 ",
1010
"authors": {
1111
"name": "Simone Salerno",
1212
"url": "https://github.com/eloquentarduino"

‎library.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=EloquentArduino
2-
version=2.0.1
3-
author=Simone Salerno <eloquentarduino@gmail.com>
4-
maintainer=Simone Salerno <eloquentarduino@gmail.com>
2+
version=2.0.2
3+
author=Simone Salerno <support@eloquentarduino.com>
4+
maintainer=Simone Salerno <support@eloquentarduino.com>
55
sentence=An eloquent interface to common Arduino patterns, data structures and algorithms
6-
paragraph=Follow the blog at eloquentarduino.github.io for details
6+
paragraph=Follow the project at eloquentarduino.com for details
77
category=Other
88
url=https://github.com/eloquentarduino/EloquentArduino
99
architectures=*

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /