Coding Issue

I recently coded our camera into eclipse. The problem is after I did that there is a red box on the bottom right that will not go away unless i remove the camera code! Any ideas as to why it wont go away? The code that is flagged has nothing to do with the camera code.

Looks like you have an unclosed brace/bracket. In your picture you show that you have the line

CameraServer cam0 = new CameraServer(0) **{**

You need to close your brackets or else Eclipse will throw an error stating that it “reached end of file while parsing”.

Where would I put the closing bracket? I’ve tried multiple things like

CameraServer cam0 = new CameraServer(0) {


}
int autoCount

and


CameraServer cam0 = new CameraServer(0);{


}
int autoCount

both create multiple errors in the codes

First of all what are you trying to declare. A usbCamera an axis camera or what? I do not recognize what your trying to declare.

A usb camera would be
UsbCamera usbCamera = new UsbCamera

Second make sure you have the cscore jar as a library.

it is a USB camera and I have CameraServer in the library. what does cscore mean?

Okay, if you want a usb cam you want do this


UsbCamera camera0; /instantiates camera

UsbCamera camera0  = CameraServer.getInstance().startAutomaticCapture();
// starts streaming the camera
camer0.setResolution (640,480); // sets resolution

Whatever your doing with the braces is not required. Cscore is camera server core which is the library for cameras. If your getting errors where it doe not know what these methods are then you would need it (I do not think that is your problem). Also don’t forget to import these.


import edu.wpi.cscore.UsbCamera;
import edu.wpi.first.wpilibj.CameraServer;
/code;

ok, thank you! ill let you know if it works or not[/quote]

No problem! If you guys need anymore help with command based programming or java robot side feel free to PM me and I will try my best to help you guys.

This is our code so far feel free to look at it.