Assignments that teach Methods

The purpose of methods is to make code more reusable and modular, and so assignments that focus on methods should seek to demonstrate how methods can simplify programs.  There are several common types of methods that students frequently create for the Finch that demonstrate how methods can be used.

Evaluating Data

The Finch API has several simple data evaluation methods already (e.g. isTemperature).  However, a given application may call for a specific type of evaluation.  For example, several assignments already posted require the user to orient the Finch in a certain direction within a given time-frame; such a method would be constantly reading both the accelerometer value of the Finch and the system time. 

Creating Output

Methods could be created that perform actions of a certain complexity.  For example, the robot dances often created by students when first programming the Finch can be made into "Dance" methods which are called whenever the program indicates a dance is warranted.  

Encapsulating Behaviors

Methods can encapsulate behaviors that dynamically alter output based on input.  For example, a simple but useful method to create might be a smart "setWheelVelocities" which moves at a given speed until either time runs out or the robot detects an obstacle.