I'm assuming the code you posted here was copied from inside a class that inherits from the SimpleRobot class? If so, then everything is mostly good. One note is that the Timer.delay() method is static, meaning you don't have to create a Timer object to use the method. In other words, use "Timer.delay(...)" instead of creating a Timer object and using "timer.delay(...)". Also, could you clarify on what the Relay is for? I'm not sure how that is fitting in to the behavior you described.
The control system documentation site has some excellent resources on the WPILibJ API. Of particular relevance is the
Java Getting Started Guide and the
WPILib Programming Guide. The Javadocs for WPILib are also included with your installation. You can find them in the C:\Users\
username\sunspotfrcsdk\doc\javadoc folder on your computer (~/sunspotfrcsdk/doc/javadoc on OS X and Linux).