the whole point of this system is the have the right camera turned on depending on which microphones are on. I managed to get this working yesterday afternoon before i saw your reply but ill explain it all anyway and maybe you guys can help me clean it up a bit.
-
there is 3 cameras and 1 still screen (which is just our logo for when we are not broadcasting from our studios eg: football game.)
-
the still screen is activated when no microphones are turned on.
-
i changed the input pull-up issue.
4.the reason the guest cam needs 2 switches is sometimes we have a guest on mic 3, other times mic 4 and sometimes both. (if there is a way to combine that into 1 switch that would be great)
- i figured out that the final line with all the &&'s could be taken out and should just say "else" instead.
here is the current code that is working when i test it but would like to make sure its okay before trying to install it.
/*
livestream cam draft
this will switch betweencams facing either the annoucer, guest, news or still screen.
*/
int Cam1 = 3;
int Cam2 = 4;
int NewsCam = 5;
int StillScreen = 6;
int Mic1 = 8;
int Mic3 = 9;
int Mic4 = 10;
int NewsMic = 11;
void setup(){
//set cams and stillscreans to outputs
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
// Enable internal pull-up resistor
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
}
void loop()
{
//begin checks for mics
if(digitalRead(11) == LOW)
{
digitalWrite(NewsCam, HIGH); //turns on cam in newsroom
digitalWrite(Cam1, LOW);
digitalWrite(Cam2, LOW);
digitalWrite(StillScreen, LOW);
}
else if (digitalRead(10) == LOW)
{
digitalWrite(Cam2, HIGH); //turns on guest cam
digitalWrite(Cam1, LOW);
digitalWrite(NewsCam, LOW);
digitalWrite(StillScreen, LOW);
}
else if (digitalRead(9) == LOW)
{
digitalWrite(Cam2, HIGH); //turns on guest cam
digitalWrite(Cam1, LOW);
digitalWrite(NewsCam, LOW);
digitalWrite(StillScreen, LOW);
}
else if (digitalRead(8) == LOW)
{
digitalWrite(Cam1, HIGH); //turns on talent cam
digitalWrite(Cam2, LOW);
digitalWrite(NewsCam, LOW);
digitalWrite(StillScreen, LOW);
}
else
{
digitalWrite(StillScreen, HIGH); //turns on stillscreen
digitalWrite(Cam1, LOW);
digitalWrite(Cam2, LOW);
digitalWrite(NewsCam, LOW);
}
}