Skip to content

Commit dddb97a

Browse files
committed
added exemple
1 parent 7e812fe commit dddb97a

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

examples/get_position/get_position.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ PelcoCam Camera1(&MyPelcoBus, //The pointer to the bus
1313
void setup() {
1414
Serial.begin(9600);
1515

16-
// Begin the bus communication at 9600 and enable logging
17-
MyPelcoBus.begin(PELCO_D9600, true);
16+
// Begin the bus communication at 9600 and disable logging
17+
MyPelcoBus.begin(PELCO_D9600, false);
1818

1919
//Is the camera online?
2020
while (!Camera1.available()) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include "Arduino.h"
2+
#include <Pelco_And_Arduino.h>
3+
4+
PelcoBus MyPelcoBus(6, // RX pin (Cam to Arduino)
5+
7); // TX pin (Arduino to Cam)
6+
7+
8+
PelcoCam Camera1(&MyPelcoBus, //The pointer to the bus
9+
1, //Address of the camera
10+
false); //We are getting a response
11+
12+
void setup() {
13+
Serial.begin(9600);
14+
15+
// Begin the bus communication at 9600 and enable logging
16+
MyPelcoBus.begin(PELCO_D9600, true);
17+
18+
//Is the camera online?
19+
while (!Camera1.available()) {
20+
Serial.println("Camera not plugged?");
21+
delay(1000);
22+
}
23+
Serial.println("Init Finished!");
24+
}
25+
26+
void loop() {
27+
//Pan to the left with max speed before turbo
28+
Camera1.send_command(PAN_L, 0x3F);
29+
delay(1000);
30+
Camera1.send_command(STOP); //Stop the camera
31+
delay(1000);
32+
//Pan to the left with less speed than the tilt speed that goes up
33+
Camera1.send_command(PAN_R, 0x3F);
34+
delay(1000);
35+
Camera1.send_command(STOP); //Stop the camera
36+
delay(1000);
37+
}

0 commit comments

Comments
 (0)