You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
8); // RE pin for manual switching modules set to -1 if it is a auto module (like a groove one)
4
+
PelcoBus MyPelcoBus(6, //RX pin (Cam to Arduino)
5
+
7, //TX pin (Arduino to Cam)
6
+
8); // RE pin for manual switching modules set to -1 or nothing if it is a auto module (like a groove one)
7
7
8
-
PelcoBus::PelcoCam Camera1; //Declare a camera
8
+
////IMPORTANT: Even if it is an old model without returning a response capabilities you need to specify a RX pin and a RE pin
9
+
10
+
PelcoCam Camera1(&MyPelcoBus, //The pointer to the bus
11
+
1, //Address of the camera
12
+
true); //We are NOT getting a response
9
13
10
14
voidsetup() {
11
15
Serial.begin(9600);
12
16
13
-
// Begin the serial communication
17
+
// Begin the bus communication at 9600 and enable logging
14
18
MyPelcoBus.begin(PELCO_D9600, true);
15
19
16
-
// Set camera settings
17
-
Camera1.address = 1; //Address of the camera
18
-
Camera1.disable_ack = true; //Old models function one 2 pair of wires and only one is usable, the TX one, so it's impossible that it can send back a reqponse
19
-
20
-
21
-
// Send stop, send_command will return a bool that indicates if the cameras sended its ACK
22
-
// It's a good way to see if the camera is plugged in
23
-
while (!MyPelcoBus.send_command(Camera1, STOP)) {
20
+
//Is the camera online? this will fail because it is an old models
21
+
while (!Camera1.available()/* <---- will fail! */) {
24
22
Serial.println("Camera not plugged?");
25
23
delay(1000);
26
24
}
@@ -30,13 +28,13 @@ void setup() {
30
28
voidloop() {
31
29
32
30
//Pan to the left with max speed before turbo
33
-
MyPelcoBus.send_command(Camera1, PAN_L, 0x3F);
31
+
Camera1.send_command(PAN_L, 0x3F);
34
32
delay(1000);
35
-
MyPelcoBus.send_command(Camera1, STOP); //Stop the camera
33
+
Camera1.send_command(STOP); //Stop the camera
36
34
delay(1000);
37
35
//Pan to the left with less speed than the tilt speed that goes up
38
-
MyPelcoBus.send_command(Camera1, PAN_R, 0x3F);
36
+
Camera1.send_command(PAN_R, 0x3F);
39
37
delay(1000);
40
-
MyPelcoBus.send_command(Camera1, STOP); //Stop the camera
0 commit comments