help needed with Camera switching code!


hi, have new camera system goes onto livestream dated radio station. dont know @ programming , code working.

basicly needs happen when certian microphones on, certian cameras need activiated.

all welcome , can give further info if need it, you!

this current code:

code: [select]
/*
 livestream cam draft
 this switch betweencams facing either annoucer, guest, news or still screen.
 
*/

int cam1 = 3;
int cam2 = 4;
int newscam = 5;
int mic1 = 8;
int mic3 = 9;
int mic4 = 10;
int newsmic = 11;
int stillscreen = 6;

void setup(){
 //set cams , stillscreans outputs
 pinmode(3, output);
 pinmode(4, output);
 pinmode(5, output);
 pinmode(6, output);
 
 //set mics inputs
 pinmode(8,input);
 pinmode(9,input);
 pinmode(10,input);
 pinmode(11,input);
 
 // 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 mics
 if(digitalread(11) == high)
 {
   digitalwrite(newscam, high); //turns on cam in newsroom
   digitalwrite(cam1, low);
   digitalwrite(cam2, low);
   digitalwrite(stillscreen, low);
 }
 else if (digitalread(10) == high)
 {
   digitalwrite(cam1, low);
   digitalwrite(newscam, low);
   digitalwrite(stillscreen, low);
   digitalwrite(cam2, high); //turns on guest cam
 }
 else if (digitalread(9) == high)
 {
   digitalwrite(cam2, high); //turns on guest cam
   digitalwrite(cam1, low);
   digitalwrite(newscam, low);
   digitalwrite(stillscreen, low);
 }
 else if (digitalread(8) == high)
 {
   digitalwrite(cam1, high); //turns on talent cam
   digitalwrite(cam2, low);
   digitalwrite(newscam, low);
   digitalwrite(stillscreen, low);
 }
 else (digitalread(8) == low && digitalread(9) == low && digitalread(10) == low && digitalread(11) == low);
 {
   digitalwrite(stillscreen, high); //turns on stillscreen
   digitalwrite(cam1, low);
   digitalwrite(cam2, low);
   digitalwrite(newscam, low);
 }
   
}


moderator edit: tags corrected

code: [select]
  switch betweencams facing either annoucer, guest, news or still screen.
this implies 4 cameras.

code: [select]
int cam1 = 3;
int cam2 = 4;
int newscam = 5;

this implies 3. why 1 halfway meaningful name, , other 2 not?

code: [select]
int mic1 = 8;
int mic3 = 9;
int mic4 = 10;
int newsmic = 11;

why still screen have microphone? presume there (undefined) relationship between these microphones , cameras. though relationship is, when there 4 of 1 , 3 of other not @ clear.

code: [select]
  //set mics inputs
  pinmode(8,input);
  pinmode(9,input);
  pinmode(10,input);
  pinmode(11,input);
 
  // enable internal pull-up resistor
  pinmode(8, input_pullup);
  pinmode(9, input_pullup);
  pinmode(10, input_pullup);
  pinmode(11, input_pullup);

make mind. want pins input or input_pullup?

why pins anonymous? gave them names earlier (though not ones).

code: [select]
  else if (digitalread(10) == high)
  {
    digitalwrite(cam1, low);
    digitalwrite(newscam, low);
    digitalwrite(stillscreen, low);
    digitalwrite(cam2, high); //turns on guest cam
  }
  else if (digitalread(9) == high)
  {
    digitalwrite(cam2, high); //turns on guest cam
    digitalwrite(cam1, low);
    digitalwrite(newscam, low);
    digitalwrite(stillscreen, low);
  }

the guest gets 2 switches?

code: [select]
  else (digitalread(8) == low && digitalread(9) == low && digitalread(10) == low && digitalread(11) == low);
if of switches off, nothing (that's ; @ end means). otherwise, no nothing. i'll bite. why?

quote
all welcome

first, need describe problem (besides obvious stuff above).


Arduino Forum > Using Arduino > Project Guidance > help needed with Camera switching code!


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support