Arduino Joystick IR Remote to control PTZ camera

I have a security camera that has Pan/Tilt/Zoom controls via Infrared that I'd like to use a Joystick Shield and Arduino to replace the handheld remote that it came with.

I have copied the remote codes and can successfully talk to the camera.
Though, when I tilt the joystick it only sends one quick pulse, moving only tiny increments. I'd love it to repeat for the duration that the joystick is tilted.

[code]
#include <IRremote.h> // >v3.0.0
#include <JoystickShield.h>
                                            
#define PIN_SEND 0
JoystickShield joystickShield; // create an instance of JoystickShield object

void setup()  
{  

  IrSender.begin(PIN_SEND); // Initializes IR sender
      delay(100);
    // new calibration function
    joystickShield.calibrateJoystick();


}  
                               
void loop()  {
  joystickShield.processEvents(); // process events

  if (joystickShield.isJoystickButton()) {
     IrSender.sendNEC(0x681, 0x7, true, 0);
  }
  if (joystickShield.isUp()) {
      IrSender.sendNEC(0x681, 0x8, true, 0);
  }
  if (joystickShield.isDown()) {
      IrSender.sendNEC(0x681, 0xA, true, 0); 
  }
  if (joystickShield.isLeft()) {
      IrSender.sendNEC(0x681, 0xB, true, 0);
  }
  if (joystickShield.isRight()) {
      IrSender.sendNEC(0x681, 0x9, true, 0);
  }
  if (joystickShield.isLeftButton()) {
     IrSender.sendNEC(0x681, 0x2C, true, 0);
  }
  if (joystickShield.isDownButton()) {
     IrSender.sendNEC(0x681, 0x5, true, 0);
  }

  if (joystickShield.isRightButton()) {
     IrSender.sendNEC(0x681, 0x1E, true, 0);
  }
  if (joystickShield.isUpButton()) {
     IrSender.sendNEC(0x681, 0x1F, true, 0);
  }
  delay(100);

}
[/code]

Thank you, any help is appreciated. I'm willing to rewrite from scratch if this method is the wrong approach towards a solution.

Look into your joystick library why this channel behaves in an unexpected way.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.