Bionic Bruins Wiki

The official wiki of the Bionic Bruins

User Tools

Site Tools



A function can be declared as:

void function() {
    // your operations here
    // any command can be put into a functions      

Functions make code look cleaner and allow code to be reused without copying and pasting. A functions is used by calling the function as:


A function can also take variables which the code inside the function uses or manipulates. For instance, the code:

void motorRun(int speed, int time);
    myMotor.setVelocity(speed, velocityUnits::rpm);
motorRun(60, 500); // speed=60rmp, time=500ms

…would run the rightMotor at speed 60 for 0.5 seconds.

coding/functions.txt · Last modified: 2019/09/06 15:09 (external edit)