Datasheet

Chapter 4 • BOE Shield-Bot Navigation
120Robotics with the BOE Shield-Bot
Example Sketch SimpleFunctionCall
Create, save, and run the SimpleFunctionCall sketch.
Watch the upload progress, and as soon as it’s done, open the Serial Monitor.
Watch your terminal and verify that the sequence of messages start with Before,
then During, then After.
// Robotics with the BOE Shield SimpleFunctionCall
// This sketch demonstrates a simple function call.
void setup() {
Serial.begin(9600);
Serial.println("Before example function call.");
delay(1000);
example(); // This is the function call
Serial.println("After example function call.");
delay(1000);
}
void loop() {
}
void example() // This is the function
{
Serial.println("During example function call.");
delay(1000);
}
Function Call with Parameters
Remember that a function can have one or more parametersdata that the function receives
and uses when it is called. The diagram below shows the
pitch function from the next
sketch. It is declared with
void pitch(int Hz). Recall that that the Arduino stores
variable values in different data types, with
int specifying an integer value in the range