SOLVED,Need help to add a sketch/code, will pay.

Hello

I wonder if someone here can help me.

Im building a rov and i use the aruino code from njs552 from:
https://sites.google.com/site/underwaterrovproject/home.

Code is working,but i need to control a RCCC_v2_Video Switch to Switch between camera 1,2 and 3.

I have found a sketch on the http://homebuiltrovs.com it is for RCCC_v2_Video Switch.

The sketch is very simple,but have no clue on how to add this to

njs552_Control_Software_Topside and njs552_Control_Software_Rov_Bottomside.

I want to use the PSB_PINK button on the PS2 control,to Switch between camera 1,2 and 3.

I can pay 25 dollar through Paypal. send me a PM

See attachments for sketch/code.

njs552_Control_Software_Topside.ino (4.67 KB)

njs552_Control_Software_Rov_Bottomside.ino (4.42 KB)

RCCC_v2_Video_Switch.ino (842 Bytes)

What do the cameras do, and why should the Arduino(s) change the active one? Which Arduino should do it? Under what circumstances?

I'm assuming that there are two POV sketches because there are two Arduinos.

Hello

The RCCC_v2_Video Switch,will be connected to the Bottomside sketch, on PIN 9 or any PWM on Arduino mega2560.

The Topside sketch, is to control RCCC_v2_Video Switch,i want to use the PSB_PINK button on the PS2 control,to Switch between camera 1,2 and 3

RCCC_v2_Video Switch,will only Switch video signal, and not control the camera (RCCC_v2_Video Switch is like a relays)

The RCCC_v2_Video Switch,will be connected to the Bottomside sketch

That will be a an interesting trick, connecting hardware to some bits in memory.

The Topside sketch, is to control RCCC_v2_Video Switch

So, the hardware is to be connected to some bits in memory on one Arduino, and controlled by the other Arduino.

There isn't a hope in hell of that happening.

I think you misunderstand me.or I mistyped what I want to do.

That will be a an interesting trick, connecting hardware to some bits in memory?
So, the hardware is to be connected to some bits in memory on one Arduino, and controlled by the other Arduino?

I think I've figured out,i have use a servo to test, i think the RCCC_v2_Video Switch is like a servo.

Video channel 1,is servo value 1000,Video channel 2 is 1500 and Video channel 3 is 2000.

When i press the PINK button on the PS2 control,servo goes to the left.
If i press it again,it goes to middle,press it again it goes to right,sow its working.

I will connect the RCCC_v2_Video Switch to Arduino mega tomorrow and see if working.

I have add this to Topside sketch:

int ButtonCount1 = 0;


int servo2;

 if(ps2x.ButtonPressed(PSB_PINK))
    {
      switch(ButtonCount1)
      {
        case 0:
        {
          data.servo2 = 1;
         ButtonCount1 = 1;
        }
        break;
        case 1:
        {
          data.servo2 = 2;
          ButtonCount1 = 2;
        }
        break;
        case 2:
        {
          data.servo2 = 0;
          ButtonCount1 = 0;
          
        }
        break;
      }
    }

I have add this to Bottomside sketch:

int servo2;

int servoPin2 = 9;

int servo2value = 1500;
int ServoNeutral = 90;
Servo Servo2;

  Servo2.attach(servoPin2);
  Servo2.writeMicroseconds(neutral);


 // servo
 if(data.servo2 == 1)
    servo2value = 1000;
 else if(data.servo2 == 2)
    servo2value = 1500;
  else
    servo2value = 2000;
  Servo2.write(servo2value);

I Have now connect RCCC_v2_Video Switch to Arduino mega and is working :slight_smile:

I have add this to Bottomside sketch:

int servo2;

int servoPin2 = 9;

int servo2value = 1500;
Servo Servo2;

  Servo2.attach(servoPin2);
  Servo2.writeMicroseconds(servo2value);

// servo
 if(data.servo2 == 1)
    servo2value = 1000;
 else if(data.servo2 == 2)
    servo2value = 2000;
  else
    servo2value = 1500;
  Servo2.write(servo2value);

I have add this to Topside sketch:

int ButtonCount1 = 0;

int servo2;

 if(ps2x.ButtonPressed(PSB_PINK))
    {
      switch(ButtonCount1)
      {
        case 0:
        {
          data.servo2 = 1;
         ButtonCount1 = 1;
        }
        break;
        case 1:
        {
          data.servo2 = 2;
          ButtonCount1 = 2;
        }
        break;
        case 2:
        {
          data.servo2 = 0;
          ButtonCount1 = 0;
         
        }
        break;
      }
    }