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:
Code:
// 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.
http://users.wpi.edu/~bamiller/WPILib/WPILib.pdf