switch is a bool variable. Did you declare it? dsio being unused is an effect of the = error because the compiler doesn't recognize that line as valid, so no go on using it.
Also, the logic on your version is bad. My version was writing the value of the digital in to a variable. Yours is using that value in a switch statement, which is used when you have different values to run between (a fancy if statement pretty much). Additionally, you are ending the switch without any code because of the ; at the end of the line. You then go onto write a block of code that will execute on every loop. Plus you throw a wait in there. not good. It will compile, but most likely will not run.
This is what I think you want:
Code:
void OperatorControl() {
DriverStationEnhancedIO &dsio = DriverStation::GetInstance()->GetEnhancedIO();
// moar code
if (dsio.GetDigital(1)) {
motor->Set(1.0);
Wait(1.0);
motor->Set(0.0);
}
Now, onto what you are actually doing. Assuming this is executing in the same task as the rest of the teleop code, by flipping the switch you are locking up the robot's controls for a whole second. That means you have no control over the robot for that second. And if you don't release the switch before the next loop of OperatorControl, you will be stuck for another second without control (this system usually loops on the order of milliseconds assuming no camera code). Also, if you are using the watchdog (which, considering what this code would do, I really hope you are), once you hit this code the watchdog will starve until the beginning of the next loop (or whenever you feed it).
If you absolutely need the 1 second run of the motor, I suggest you export the code for this to another task and communicate via a class variable