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
This exemple is based on the simple example from examples\simple\simple.ino
6
-
However, it is designed for the old model of the Pelco cameras.
7
-
The old models works in the protocol RS422 so it need 2 pair of cable to communicate.
8
-
If you have only one pair (preferably for sending commands), you can disable acknoledge when sending commands
4
+
PelcoBus MyPelcoBus(6, // TX pin (Arduino to Cam)
5
+
7, // RX pin (Cam to Arduino)
6
+
8); // RE pin for manual switching modules set to -1 if it is a auto module (like a groove one)
9
7
10
-
*/
11
-
12
-
PelcoCamBus MyPelcoBus(6, // TX pin (Arduino to Cam)
13
-
7, // RX pin (Cam to Arduino)
14
-
8); // RE pin for manual switching modules set to -1 if it is a auto module (like a groove one)
8
+
PelcoBus::PelcoCam Camera1; //Declare a camera
15
9
16
10
voidsetup() {
17
-
18
11
Serial.begin(9600);
19
12
20
13
// Begin the serial communication
21
14
MyPelcoBus.begin(PELCO_D9600, true);
22
15
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
+
23
21
// Send stop, send_command will return a bool that indicates if the cameras sended its ACK
24
22
// It's a good way to see if the camera is plugged in
PelcoCamBusMyPelcoBus(6, // TX pin (Arduino to Cam)
5
-
7, // RX pin (Cam to Arduino)
6
-
8); // RE pin for manual switching modules set to -1 if it is a auto module (like a groove one)
4
+
PelcoBusMyPelcoBus(6, // TX pin (Arduino to Cam)
5
+
7, // RX pin (Cam to Arduino)
6
+
8); // RE pin for manual switching modules set to -1 if it is a auto module (like a groove one)
7
7
8
8
voidsetup() {
9
+
//Here we don't need to declare a camera because all we send is raw
9
10
10
11
Serial.begin(9600);
11
12
12
13
// Begin the serial communication
13
14
MyPelcoBus.begin(PELCO_D9600, true);
14
15
15
-
// Send stop, send_command will return a bool that indicates if the cameras sended its ACK
16
-
// It's a good way to see if the camera is plugged in
17
-
while (!MyPelcoBus.send_command(1, STOP)) {
18
-
Serial.println("Camera not plugged?");
19
-
delay(1000);
20
-
}
21
16
Serial.println("Init Finished!");
22
17
}
23
18
24
19
voidloop() {
25
20
while(Serial.available()) {
26
21
String in = Serial.readString(); //Read from the serial
27
22
MyPelcoBus.send_raw(in); //Send the raw command to the cameras (adress can be another than the one declared in the object because it's raw transmission)
28
-
delay(500);
29
-
MyPelcoBus.send_command(1, STOP); //Stop it after a while
23
+
//You will need to stop it manually
24
+
// Very simple: just send this commnad : "FF *address* 00 00 00 00 01"
0 commit comments