-
Notifications
You must be signed in to change notification settings - Fork 21
/
ESP32_FreeRTOS.ino
133 lines (106 loc) · 1.78 KB
/
ESP32_FreeRTOS.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <GoProControl.h>
#include "Secrets.h"
/*
Example with the FreeRTOS framework
*/
GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA);
void setup()
{
gp.enableDebug(&Serial);
xTaskCreate(keep_alive, "keep_alive", 10000, NULL, 1, NULL);
}
void loop()
{
char in = 0;
if (Serial.available() > 0)
{
in = Serial.read();
}
switch (in)
{
default:
break;
// Connect
case 'C':
gp.begin();
break;
// Turn on and off
case 'T':
gp.turnOn();
break;
case 't':
gp.turnOff();
break;
// Take a picture of start a video
case 'A':
gp.shoot();
break;
// Stop the video
case 'S':
gp.stopShoot();
break;
// Set modes
case 'V':
gp.setMode(VIDEO_MODE);
break;
case 'P':
gp.setMode(PHOTO_MODE);
break;
case 'M':
gp.setMode(MULTISHOT_MODE);
break;
// Change the orientation
case 'u':
gp.setOrientation(ORIENTATION_UP);
break;
case 'd':
gp.setOrientation(ORIENTATION_DOWN);
break;
// Change other parameters
case 'W':
gp.setVideoFov(MEDIUM_FOV);
break;
case 'E':
gp.setFrameRate(FR_120);
break;
case 'f':
gp.setPhotoResolution(PR_11MP_WIDE);
break;
case 'F':
gp.setVideoResolution(VR_1080p);
break;
case 'L':
gp.setTimeLapseInterval(60);
break;
// Localize the camera
case 'O':
gp.localizationOn();
break;
case 'I':
gp.localizationOff();
break;
// Delete some files, be carefull!
case 'l':
gp.deleteLast();
break;
case 'D':
gp.deleteAll();
break;
// Print useful data
case 'p':
gp.printStatus();
break;
// Close the connection
case 'X':
gp.end();
break;
}
}
void keep_alive(void *parameter)
{
while (1)
{
gp.keepAlive();
}
vTaskDelete(NULL);
}