-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservidor2.cpp
More file actions
84 lines (76 loc) · 2.02 KB
/
Copy pathservidor2.cpp
File metadata and controls
84 lines (76 loc) · 2.02 KB
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
#include "projeto.hpp"
#include "cekeikon.h"
#include <wiringPi.h>
#include <softPwm.h>
int main(void)
{
SERVER server;
server.waitConnection();
wiringPiSetup () ;
if (softPwmCreate(0, 0, 100)) erro("erro");
if (softPwmCreate(1, 0, 100)) erro("erro");
if (softPwmCreate(2, 0, 100)) erro("erro");
if (softPwmCreate(3, 0, 100)) erro("erro");
VideoCapture cam(0);
if (!cam.isOpened()) erro("Erro: Abertura de webcam.");
cam.set(CV_CAP_PROP_FRAME_WIDTH,320);
cam.set(CV_CAP_PROP_FRAME_HEIGHT,240);
Mat_<COR> image;
cam >> image;
uint32_t comando = 0;
int ch = -1;
while (ch <0)
{
cam >> image;
flip(image, image, -1);
server.receiveUint(comando);
putTxt (image, 10, 10, to_string (comando), COR (0,255,0), 4);
server.sendImgComp (image);
if (comando == 7){
softPwmWrite (0, 100);
softPwmWrite (1, 0);
softPwmWrite (2, 0);
softPwmWrite (3, 0);
} else if (comando == 8){
softPwmWrite (0, 100);
softPwmWrite (1, 0);
softPwmWrite (2, 0);
softPwmWrite (3, 100);
} else if (comando == 9){
softPwmWrite (0, 0);
softPwmWrite (1, 0);
softPwmWrite (2, 0);
softPwmWrite (3, 100);
} else if (comando == 4){
softPwmWrite (0, 100);
softPwmWrite (1, 0);
softPwmWrite (2, 100);
softPwmWrite (3, 0);
} else if (comando == 0){
softPwmWrite (0, 0);
softPwmWrite (1, 0);
softPwmWrite (2, 0);
softPwmWrite (3, 0);
} else if (comando == 6){
softPwmWrite (0, 0);
softPwmWrite (1, 100);
softPwmWrite (2, 0);
softPwmWrite (3, 100);
} else if (comando == 1){
softPwmWrite (0, 0);
softPwmWrite (1, 0);
softPwmWrite (2, 100);
softPwmWrite (3, 0);
} else if (comando == 2){
softPwmWrite (0, 0);
softPwmWrite (1, 100);
softPwmWrite (2, 100);
softPwmWrite (3, 0);
} else if (comando == 3){
softPwmWrite (0, 0);
softPwmWrite (1, 100);
softPwmWrite (2, 0);
softPwmWrite (3, 0);
}
}
}