- Posts: 31
- Joined: Sat Mar 09, 2013 7:23 pm
Hi,
I have developed an Arduino / SDI shield simple sketch to control Iris / setup and have an auto Iris available to live use, using an Arduino Uno, four 10k ohms pot and two 1x1 switchers ( I tried to attached the sketch but I got the mesage .ext not allowed, so I copy and past it bellow), but I would like to do the same using an Atem and an Ethernet shield instead a SDI shield.
I know that Skaarhoj have many stuff on this area, and I tried to use the Skaarhoj libraries but I got the message:
exit status 1
Error compiling for board Arduino/Genuino Uno.
I tried also with a Leonardo and Mega
I`m not an expert and smart C++ programmer, so any help will be very useful and welcome, and if you read my sketch probably you could do it better.
I read the ATEM SDK and the Skaarhoj BlackMagic ATEM Switcher Protocol, but to me have a gap in between that information and the commands to use in the Arduino Sketch
I appreciate any, examples or help.
Thanks
/ atenção, as portas foram modificadas e o sentido dos pots para atender a montagem
#include <BMDSDIControl.h>
double IRISA = A1;
double PedA = A0;
double IRISB = A3;
double PedB = A2;
const int shieldAddress = 0x6E;
//----------------chave------------
int chave1 = 7; // Connected to Chave on KY-040-1
int state1 = HIGH;
int estado1;
int anterior1 = LOW;
long time = 0;
long debounce = 200;
//------------------------------------------
//BMD_SDICameraControl_I2C sdiCameraControl(shieldAddress);
int CAMERAA = 5;
int CAMERAB = 6;
//____________________________________________________________
void setup() {
// ----------------------Chave 1 -----------------
pinMode(7, INPUT_PULLUP);
pinMode(chave1, INPUT);
pinMode(LED_BUILTIN, OUTPUT); // só para acender o led da placa
//----------------------------------------------------------------
// sdiCameraControl.begin();
// sdiCameraControl.setOverride(true);
Wire.setClock(400000);
Serial.begin(9600);
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
}
//____________________________________________________________
void loop() {
//------------------- Chave latch1 LED --------------------
{
estado1 = digitalRead(chave1);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (estado1 == HIGH && anterior1 == LOW && millis() - time > debounce) {
if (state1 == HIGH)
state1 = LOW;
else
state1 = HIGH;
time = millis();
}
//-------------------- acende LED --------------------
digitalWrite(LED_BUILTIN, state1);
anterior1 = estado1;
//}
// {
estado1 = digitalRead(chave1);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (estado1 == HIGH && anterior1 == LOW && millis() - time > debounce) {
if (state1 == HIGH)
state1 = LOW;
else
state1 = HIGH;
time = millis();
}
digitalWrite(LED_BUILTIN, state1);
anterior1 = estado1;
}
//----------------------------------
BMD_SDICameraControl_I2C sdiCameraControl(shieldAddress);
//-----------
if (state1== LOW) {
Serial.print ("Ch/1-LO ");
sdiCameraControl.setOverride(true);
}
// sdiCameraControl.begin();
// sdiCameraControl.setOverride(true);
// }
else {
// sdiCameraControl.stop();
sdiCameraControl.setOverride(false);
}
//sdiCameraControl.setOverride(true);
//-------------------------------
// preparação das variáveis de A
IRISA = analogRead(A1);
IRISA = map ( IRISA , 0, 1023, 100, 0);
IRISA = IRISA / 100;
PedA = analogRead(A0);
PedA = map ( PedA , 0, 1023, -800, 800);
PedA = PedA / 800;
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)
};
//--------------------------------------------
// preparação das variáveis de B
IRISB = analogRead(A3);
IRISB = map ( IRISB , 0, 1023, 100, 0);
IRISB = IRISB / 100;
PedB = analogRead(A2);
PedB = map ( PedB , 0, 1023, -800, 800);
PedB = PedB / 800;
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)
};
//------------------------------------------------------------------
//Teste do estado do pino digital 3 e ajustes camera A
if (digitalRead(3) == 0) {
sdiCameraControl.writeCommandVoid(
CAMERAA, // Destination: Camera A
0, // Category: Lens
5 // Param: Auto Iris
);
}
else
// Send new aperture adjustment to the camera A
sdiCameraControl.writeCommandFixed16(
CAMERAA, // Destination: CAMERA A
0, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute,
IRISA // Values
);
//-------------------------------------------------
//Teste do estado do pio digital 2, e ajustes camera B
if (digitalRead(2) != 1) {
sdiCameraControl.writeCommandVoid(
CAMERAB, // Destination: Camera B
0, // Category: Lens
5 // Param: Auto Iris
);
}
else
// Send new aperture adjustment to the camera C
sdiCameraControl.writeCommandFixed16(
CAMERAB, // Destination: CAMERA B
0, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute,
IRISB // 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 pedestal adjustment to the cameraB
sdiCameraControl.writeCommandFixed16(
CAMERAB, // Destination: CAMERAB
8, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute
offsetValuesB // Values
);
//---------------------------------------------------------------------
// Impressão para desenvolvimento e verificação
Serial.print("IrisA ");
Serial.print(IRISA);
Serial.print(" ");
Serial.print("ID 2 ");
Serial.print(digitalRead(2));
Serial.print(" ");
Serial.print("Ped A ");
Serial.print( PedA );
Serial.print("\t");
Serial.print("IrisB ");
Serial.print(IRISB);
Serial.print(" ");
Serial.print("ID 3 ");
Serial.print(digitalRead(3));
Serial.print(" ");
Serial.print("Ped b ");
Serial.print( PedB );
Serial.print("\t");
Serial.println("");
//--------------------------------------------------------
}
/////////////////////////////// FIM /////////////////////////////
I have developed an Arduino / SDI shield simple sketch to control Iris / setup and have an auto Iris available to live use, using an Arduino Uno, four 10k ohms pot and two 1x1 switchers ( I tried to attached the sketch but I got the mesage .ext not allowed, so I copy and past it bellow), but I would like to do the same using an Atem and an Ethernet shield instead a SDI shield.
I know that Skaarhoj have many stuff on this area, and I tried to use the Skaarhoj libraries but I got the message:
exit status 1
Error compiling for board Arduino/Genuino Uno.
I tried also with a Leonardo and Mega
I`m not an expert and smart C++ programmer, so any help will be very useful and welcome, and if you read my sketch probably you could do it better.
I read the ATEM SDK and the Skaarhoj BlackMagic ATEM Switcher Protocol, but to me have a gap in between that information and the commands to use in the Arduino Sketch
I appreciate any, examples or help.
Thanks
/ atenção, as portas foram modificadas e o sentido dos pots para atender a montagem
#include <BMDSDIControl.h>
double IRISA = A1;
double PedA = A0;
double IRISB = A3;
double PedB = A2;
const int shieldAddress = 0x6E;
//----------------chave------------
int chave1 = 7; // Connected to Chave on KY-040-1
int state1 = HIGH;
int estado1;
int anterior1 = LOW;
long time = 0;
long debounce = 200;
//------------------------------------------
//BMD_SDICameraControl_I2C sdiCameraControl(shieldAddress);
int CAMERAA = 5;
int CAMERAB = 6;
//____________________________________________________________
void setup() {
// ----------------------Chave 1 -----------------
pinMode(7, INPUT_PULLUP);
pinMode(chave1, INPUT);
pinMode(LED_BUILTIN, OUTPUT); // só para acender o led da placa
//----------------------------------------------------------------
// sdiCameraControl.begin();
// sdiCameraControl.setOverride(true);
Wire.setClock(400000);
Serial.begin(9600);
pinMode(A0, INPUT_PULLUP);
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
}
//____________________________________________________________
void loop() {
//------------------- Chave latch1 LED --------------------
{
estado1 = digitalRead(chave1);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (estado1 == HIGH && anterior1 == LOW && millis() - time > debounce) {
if (state1 == HIGH)
state1 = LOW;
else
state1 = HIGH;
time = millis();
}
//-------------------- acende LED --------------------
digitalWrite(LED_BUILTIN, state1);
anterior1 = estado1;
//}
// {
estado1 = digitalRead(chave1);
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (estado1 == HIGH && anterior1 == LOW && millis() - time > debounce) {
if (state1 == HIGH)
state1 = LOW;
else
state1 = HIGH;
time = millis();
}
digitalWrite(LED_BUILTIN, state1);
anterior1 = estado1;
}
//----------------------------------
BMD_SDICameraControl_I2C sdiCameraControl(shieldAddress);
//-----------
if (state1== LOW) {
Serial.print ("Ch/1-LO ");
sdiCameraControl.setOverride(true);
}
// sdiCameraControl.begin();
// sdiCameraControl.setOverride(true);
// }
else {
// sdiCameraControl.stop();
sdiCameraControl.setOverride(false);
}
//sdiCameraControl.setOverride(true);
//-------------------------------
// preparação das variáveis de A
IRISA = analogRead(A1);
IRISA = map ( IRISA , 0, 1023, 100, 0);
IRISA = IRISA / 100;
PedA = analogRead(A0);
PedA = map ( PedA , 0, 1023, -800, 800);
PedA = PedA / 800;
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)
};
//--------------------------------------------
// preparação das variáveis de B
IRISB = analogRead(A3);
IRISB = map ( IRISB , 0, 1023, 100, 0);
IRISB = IRISB / 100;
PedB = analogRead(A2);
PedB = map ( PedB , 0, 1023, -800, 800);
PedB = PedB / 800;
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)
};
//------------------------------------------------------------------
//Teste do estado do pino digital 3 e ajustes camera A
if (digitalRead(3) == 0) {
sdiCameraControl.writeCommandVoid(
CAMERAA, // Destination: Camera A
0, // Category: Lens
5 // Param: Auto Iris
);
}
else
// Send new aperture adjustment to the camera A
sdiCameraControl.writeCommandFixed16(
CAMERAA, // Destination: CAMERA A
0, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute,
IRISA // Values
);
//-------------------------------------------------
//Teste do estado do pio digital 2, e ajustes camera B
if (digitalRead(2) != 1) {
sdiCameraControl.writeCommandVoid(
CAMERAB, // Destination: Camera B
0, // Category: Lens
5 // Param: Auto Iris
);
}
else
// Send new aperture adjustment to the camera C
sdiCameraControl.writeCommandFixed16(
CAMERAB, // Destination: CAMERA B
0, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute,
IRISB // 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 pedestal adjustment to the cameraB
sdiCameraControl.writeCommandFixed16(
CAMERAB, // Destination: CAMERAB
8, // Category: Lens
3, // Param: Aperture (Ordinal)
0, // Operation: Set Absolute
offsetValuesB // Values
);
//---------------------------------------------------------------------
// Impressão para desenvolvimento e verificação
Serial.print("IrisA ");
Serial.print(IRISA);
Serial.print(" ");
Serial.print("ID 2 ");
Serial.print(digitalRead(2));
Serial.print(" ");
Serial.print("Ped A ");
Serial.print( PedA );
Serial.print("\t");
Serial.print("IrisB ");
Serial.print(IRISB);
Serial.print(" ");
Serial.print("ID 3 ");
Serial.print(digitalRead(3));
Serial.print(" ");
Serial.print("Ped b ");
Serial.print( PedB );
Serial.print("\t");
Serial.println("");
//--------------------------------------------------------
}
/////////////////////////////// FIM /////////////////////////////