Hi, I am a new coder at my school district with no guidance on how to code the robot, this is my first time coding real Java and using VSCode and I am unable to figure out why my code is erroring. Even a blank template
has many errors, below I attached my code, assistance would be appreciated.
You appear to be using standard VSCode. You should use WPILib 2024 VSCode. Have you read through zero-to-robot yet?
Or that Red Hat extension was added to an otherwise correct VSC installation. OP has to be careful - some unauthorized extensions are handy and some are destructive.
Thanks for the help but I am using the correct version of VS-Code, just in case I reinstalled the WPILIB variant of VS-Code and opened it the proper way through the desktop shortcut, regardless of doing all that my code still errors. After playing around I found the cause of the errors but I don’t know how to solve it.
The cause is these two lines:
// The left motor is CCW+
currentConfigs.Inverted = InvertedValue.CounterClockwise_Positive;
//CAUSING ALL ERRORS:
m_leftLeader.getConfigurator().apply(currentConfigs);
// The right motor is CW+
currentConfigs.Inverted = InvertedValue.Clockwise_Positive;
// CAUSING ALL ERRORS
m_rightLeader.getConfigurator().apply(currentConfigs);
When I comment out the bolded lines, all the errors that shouldn’t be happening go away.
I am attaching a second image in another reply.
The problem is that you’re trying to put code that belongs in a method in the class.
Thanks all of the errors are gone now