Skip to content

Commit 7fef7be

Browse files
author
Konrad Iturbe
committed
Re-add keepAlive
1 parent ba7609f commit 7fef7be

File tree

2 files changed

+115
-5
lines changed

2 files changed

+115
-5
lines changed
Lines changed: 109 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#include <GoProControl.h>
22
#include "Constants.h"
33

4+
uint8_t gopro_mac_address[6] = {1,2,3,4,5,6};
45
// Choose your camera
56
//GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA); // use this if you have a HERO3 or older
6-
//GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, gopro_mac_address, BOARD_NAME); // use this if you have a HERO4 or newer
7+
GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, gopro_mac_address, BOARD_NAME); // use this if you have a HERO4 or newer
8+
9+
char in = 0;
710

811
void setup()
912
{
@@ -13,10 +16,112 @@ void setup()
1316

1417
void loop()
1518
{
16-
// do stuff
19+
if (Serial.available() > 0)
20+
{
21+
in = Serial.read();
22+
//Serial.write(in);
23+
}
24+
25+
switch (in)
26+
{
27+
default:
28+
break;
29+
30+
// connect
31+
case 'C':
32+
gp.begin();
33+
break;
34+
35+
// turn on/off
36+
case 'T':
37+
gp.turnOn();
38+
break;
39+
40+
case 't':
41+
gp.turnOff();
42+
break;
43+
44+
// take a picture of start a video
45+
case 'A':
46+
gp.shoot();
47+
break;
48+
49+
// stop the video
50+
case 'S':
51+
gp.stopShoot();
52+
break;
53+
54+
//set modes
55+
case 'V':
56+
gp.setMode(VIDEO_MODE);
57+
break;
58+
59+
case 'P':
60+
gp.setMode(PHOTO_MODE);
61+
break;
62+
63+
case 'M':
64+
gp.setMode(MULTISHOT_MODE);
65+
break;
66+
67+
// set orientation
68+
case 'u':
69+
gp.setOrientation(ORIENTATION_UP);
70+
break;
71+
72+
case 'd':
73+
gp.setOrientation(ORIENTATION_DOWN);
74+
break;
75+
76+
case 'W':
77+
gp.setVideoFov(MEDIUM_FOV);
78+
break;
79+
80+
case 'E':
81+
gp.setFrameRate(FR_120);
82+
break;
83+
84+
case 'f':
85+
gp.setPhotoResolution(PR_11MP_WIDE);
86+
break;
87+
88+
case 'F':
89+
gp.setVideoResolution(VR_1080p);
90+
break;
91+
92+
case 'L':
93+
gp.setTimeLapseInterval(60);
94+
break;
95+
96+
case 'O':
97+
gp.localizationOn();
98+
break;
99+
100+
case 'I':
101+
gp.localizationOff();
102+
break;
103+
104+
case 'l':
105+
gp.deleteLast();
106+
break;
107+
108+
case 'D':
109+
gp.deleteAll();
110+
break;
111+
112+
case 'X':
113+
gp.end();
114+
break;
115+
116+
case 'p':
117+
gp.printStatus();
118+
break;
119+
}
120+
121+
in = 0;
17122
}
18123

19124
void keep_alive(void *parameter)
20125
{
21-
gp.keepAlive();
22-
}
126+
gp.shoot();
127+
}

examples/GoProControl/GoProControl.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Choose your camera
55
//GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA); // use this if you have a HERO3 or older
6-
//GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, gopro_mac_address, BOARD_NAME); // use this if you have a HERO4 or newer
6+
//GoProControl gp(GOPRO_SSID, GOPRO_PASS, CAMERA, gopro_mac_address, BOARD_NAME);
77

88
char in = 0;
99

@@ -114,7 +114,12 @@ void loop()
114114
case 'p':
115115
gp.printStatus();
116116
break;
117+
118+
case 'K':
119+
gp.keepAlive();
120+
break;
117121
}
118122

119123
in = 0;
124+
gp.keepAlive();
120125
}

0 commit comments

Comments
 (0)