Mon Oct 10, 2016 3:36 pm
Below you have an arduino sketch to control up to two cameras with only an SDI shield. As you can see I`m not an Arduino expert and probably the sketch could be improved. Please feel free to comment it and make changes, and I hope it could be useful for someone.
Somebody know if the Shield could work with the arduino Mega?
I`m working in an sketch to control more them two cameras with only one SDI Shield, and my go is to use digital arduino ports with encoders. Somebody cam help me?
thanks
---------------------------------------------------------------------
#include <BMDSDIControl.h>
const double IRISA = A0;
const double PedA = A1;
const double IRISB = A2;
const double PedB = A3;
const int shieldAddress = 0x6E;
BMD_SDICameraControl_I2C sdiCameraControl(shieldAddress);
BMD_SDITallyControl_I2C sdiTallyControl(shieldAddress);
const int CAMERAA = 1;
const int CAMERAB = 2;
void setup() {
// put your setup code here, to run once:
sdiCameraControl.begin();
sdiCameraControl.setOverride(true);
Wire.setClock(400000);
Serial.begin(9600);
}
void loop() {
// preparação das variáveis de A
float IRISA = analogRead(A0);
IRISA = map ( IRISA , 0, 1023, 0,1000);
IRISA = IRISA /1000;
float PedA = analogRead(A1);
PedA = map ( PedA , 0, 1023, -8000,8000);
PedA = PedA /1000;
IRISA = constrain(IRISA, 0 , 1.0);
PedA = constrain(PedA, -8.0 , 8.0);
float offsetValuesA[] = {
PedA, // Red (-8.0 to 8.0)
PedA, // Green (-8.0 to 8.0)
PedA, // Blue (-8.0 to 8.0)
PedA, // Luma (-8.0 to 8.0)
};
Serial.println(IRISA );
Serial.println(PedA);
// preparação das variáveis de B
float IRISB = analogRead(A2);
IRISB = map ( IRISB , 0, 1023, 0,1000);
IRISB = IRISB /1000;
float PedB = analogRead(A3);
PedB = map ( PedB , 0, 1023, -8000,8000);
PedB = PedB /1000;
IRISB = constrain(IRISB, 0 , 1.0);
PedB = constrain(PedB, -8.0 , 8.0);
float offsetValuesB[] = {
PedB, // Red (-8.0 to 8.0)
PedB, // Green (-8.0 to 8.0)
PedB, // Blue (-8.0 to 8.0)
PedB, // Luma (-8.0 to 8.0)
};
Serial.println(IRISB );
Serial.println(PedB);
// Send new aperture adjustment to the cameraA
sdiCameraControl.writeCommandFixed16(
CAMERAA, // Destination: CAMERAB
0, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute,
IRISA // Values
);
// Send new pedestal adjustment to the cameraA
sdiCameraControl.writeCommandFixed16(
CAMERAA, // Destination: CAMERAA
8, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute
offsetValuesA // Values
);
// Send new aperture adjustment to the cameraB
sdiCameraControl.writeCommandFixed16(
CAMERAB, // Destination: CAMERAB
0, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute,
IRISB // Values
);
// Send new pedestal adjustment to the cameraB
sdiCameraControl.writeCommandFixed16(
CAMERAB, // Destination: CAMERAB
8, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute
offsetValuesB // Values
);
}