Hi noobie here, not sure if this is the correct forum,
Have a code loaded on a Arduino and can control either the Pan or Tilt as long as only I pin is connected as soon as I connect the 2nd or 3rd pin the mount stops responding.
Just connecting the tripod connections to the Nano the pan goes to the maximum right position.
Is there something in the code I am missing or my pinout connections.
I tried 3 different Nanos with the same result.
Code
#define left 11 // Pin 12 controls left pan
#define right 10 // Pin 10 controls right pan
#define down 12 // Pin 9 controls down tilt
#define up 9 // Pin 8 controls up tilt
#define zoomin A0 // Pin A0 controls Zoom In
#define zoomout A1 // Pin A1 controls Zoom Out
#define zoom 4 // Pin 4 connected to RC receiver channel 3 which controls Zoom
#define receiver 3 // Pin 3 connected to RC receiver channel 1 which controls Tilt
#define receiver2 2 // Pin 2 connected to RC receiver channel 2 which controls Pan
// Note that Pin 5 is connected to RC receiver channel 4 but is not used in this code
// Variables to hold the RC Receiver received values
int ch1 = 0;
int ch2 = 0;
int ch3 = 0;
void setup()
{
// Set the Pin modes
pinMode(receiver, INPUT);
pinMode(receiver2, INPUT);
pinMode(zoom, INPUT);
pinMode(left, OUTPUT);
pinMode(right, OUTPUT);
pinMode(down, OUTPUT);
pinMode(up, OUTPUT);
pinMode(zoomin, OUTPUT);
pinMode(zoomout, OUTPUT);
//Write all pins LOW at start
digitalWrite(up, LOW);
digitalWrite(down, LOW);
digitalWrite(left, LOW);
digitalWrite(right, LOW);
digitalWrite(zoomin, LOW);
digitalWrite(zoomout, LOW);
}
void loop() {
// Get current values of RC Receiver Channels
ch1 = pulseIn(receiver, HIGH, 20000);
ch2 = pulseIn(receiver2, HIGH, 20000);
ch3 = pulseIn(zoom, HIGH, 20000);
// Tilt based on the input from the Right (Up-Down movement) joystick from the RC Transmitter
if (ch1 < 1200) // Transmitter Joystick pushed UP
{
digitalWrite(up, HIGH);
//analogWrite(up, 255); // Move the Bescor MP-101 Camera Tilt UP
}
else if (ch1 > 1700) // Tranmitter Joystick pushed DOWN
{
//analogWrite(down, 255); // Move the Bescor MP-101 Camera Tilt DOWN
digitalWrite(down, HIGH);
}
else // Put pins LOW to stop Tilt movement of Bescor MP-101
{
digitalWrite(up, LOW);
digitalWrite(down, LOW);
}
// Pan based on the input from the Right (Left-Right movement) joystick from the RC Transmitter
if (ch2 < 1200) // Transmitter Joystick pushed Left
{
digitalWrite(left, HIGH); // Move the Bescor MP-101 Camera Pan LEFT
}
else if (ch2 > 1700) // Transmitter Joystick pushed RIGHT
{
digitalWrite(right, HIGH); // Move the Bescor MP-101 Camera Pan RIGHT
}
else // Put pins LOW to stop Pan movement of Bescor MP-101
{
digitalWrite(right, LOW);
digitalWrite(left, LOW);
}
// Zoom based on the input from the Left (Up-Down movement) joystick from the RC Transmitter
if (ch3 < 1000) // Transmitter Joystick pushed UP
{
digitalWrite(zoomin, HIGH); // Simulate pushing the Zoom IN tact switch on the eBenk LANC remote
}
else if (ch3 > 2000) // Transmitter Joystick pushed DOWN
{
digitalWrite(zoomout, HIGH); // Simulate pushing the Zoom OUT tact switch on the eBenk LANC remote
}
else // Put pins LOW to stop ZOOM
{
digitalWrite(zoomin, LOW);
digitalWrite(zoomout, LOW);
}
}