boolean showRestrictedZones = false;
boolean selectingColor = false;
boolean trackingColor = false;
int trackColorTolerance = 100;
int trackColorRed = 255;
int trackColorGreen = 255;
int trackColorBlue = 255;
boolean selectingSafeColor = false;
boolean safeColor = false;
int safeColorMinSize = 500;
int safeColorTolerance = 100;
int safeColorRed = 0;
int safeColorGreen = 255;
int safeColorBlue = 0;
boolean useArrowKeys = false; // use arrow keys to finely adjust the aiming (in manual mode)
public boolean useInputDevice = false; // use a joystick or game controller as input (in manual mode)
public boolean inputDeviceIsSetup = false;
public ControllIO controlIO; // more stuff for using a joystick or game controller for input
public ControllDevice inputDevice;
public ControllButton[] buttons = new ControllButton[30];
public ControllSlider[] sliders = new ControllSlider[10];
public ControllButton[] fire_buttons = new ControllButton[0];
public ControllButton[] preciseAim_buttons = new ControllButton[0];
public ControllButton[] centerGun_buttons = new ControllButton[0];
public ControllButton[] autoOn_buttons = new ControllButton[0];
public ControllButton[] autoOff_buttons = new ControllButton[0];
public ControllButton[] inputToggle_buttons = new ControllButton[0];
public ControllButton[] randomSound_buttons = new ControllButton[0];
public ControllSlider[] pan_sliders = new ControllSlider[0];
public ControllSlider[] tilt_sliders = new ControllSlider[0];
public ControllSlider[] panInvert_sliders = new ControllSlider[0];
public ControllSlider[] tiltInvert_sliders = new ControllSlider[0];
public float xPosition = camWidth/2;
public float yPosition = camHeight/2;
String[] inStringSplit; // buffer for backup
int controlMode_i, safety_i, firingMode_i, scanWhenIdle_i, trackingMotion_i, trackingColor_i, leadTarget_i, safeColor_i,
showRestrictedZones_i, showDifferentPixels_i, showTargetBox_i, showCameraView_i, mirrorCam_i, soundEffects_i;
void setup() {
loadSettings();
size(camWidth, camHeight); // some users have reported a faster framerate when the code utilizes OpenGL. To try this, comment out this line and uncomment the line below.
// size(camWidth, camHeight, OPENGL);
minim = new Minim(this);
loadSounds();
playSound(18);
camInput = new JMyron();
camInput.start(camWidth, camHeight);
camInput.findGlobs(0);
camInput.adaptivity(1.01);
camInput.update();
currFrame = camInput.image();
rawImage = camInput.image();
Background = camInput.image();
rawBackground = camInput.image();
screenPixels = camInput.image();
target = new BlobDetection(camWidth, camHeight);
target.setThreshold(0.9);
target.setPosDiscrimination(true);
retryArduinoConnect();
xRatio = (camWidth / (xMax - xMin)); // used to allign sights with crosshairs on PC
yRatio = (camHeight/ (yMax - yMin)); //
drawControlPanel();
}