WPILib Op. Control mode

Our team is working with WPILib. We’ve seen many example of sample
code that would work in Autonomous mode, but
very few examples of how to handle Operator Control mode where we have
to listen for hardware interrupts, process commands
and stuff. Is it possible that we could get a very simple example of
what would be expected of us in the software arena for Operator
mode? Many thanks!

You will pretty much write your code the exact same way you would if you were using IFI’s default code. Your control over the robots hardware is at a higher level in WPILib, so it will take some getting used to. At its most simple point, you will be calling functions to set motor values rather than assigning variables. At a more complicated point, you can write new device drivers to talk with sensors that aren’t supported “out of the box”.

If you want to watch for interrupts, you can use a cool feature of WPILib called an Interrupt Watcher. This is pretty simple… You set up the interrupt watcher by giving it a port number. When the interrupt occurs, it sets a flag. In your main loop, you can check that flag. Pretty simple, pretty easy. This will come in handy if you have a sensor where you need to keep track of whether it was fired or not, and the operation of the sensor may be too fast for your main loop

From WPILib documentation:

// initialize interrupt watcher on port 1 looking for a rising edge 
//    this is an input going from low to high (like a switch opening) 
StartInterruptWatcher(1, RISING_EDGE); 
while (1) 
{ 
  
  // the time to poll the digital input port that was being watched 
  // 
  // 
  // check if the value has changed since the last check 
  if (GetInterruptWatcher(1) == 1) 
  { 
    printf("Interrupt Occurred!\r");
  } 
  // 
  // program doing more work over here. 
  // 
} 

If you chose, you can also set up an ISR to handle these interrupts.

Take a look at the WPILib documentation. It is very well written and should help you out alot. Read the entire thing before you sit down to code.

With WPILib, I am trying to set the various LED lights on the controller. When I
call SetOILed( …, … ), the compiler pukes “call of function without prototype”.
I believe this is due to the way this function is conditionally included. It
appears to not be available to us with the 2007 kit. Is this correct or am I doing
something wrong?

Make sure you’ve defined the symbol _FRC_BOARD in the defines section of MPLab, eclipse or whatever tool you are using.