The provided driver allows users to control the BrainBot without needing to understand advanced details.
You must complete the BrainBot Introduction lesson first. This page is just a quick reference of the API. Skim through it quickly and jump to the next lesson.
This page is a summary of the BrainBot API drivers found in all programming language options.
- Beep(): Generates a short beep on the BrainBot’s buzzer.
- SoundOn(frequency): Activates the buzzer at a specific frequency. Note that the buzzer is the one found on the BrainBot (connected to P0).
- SoundOff(): Turns the buzzer off.
- Move(leftMotorSpeed, rightMotorSpeed): The Move() function takes a value from -100 to 100.
- Stop(): Stops both motors from moving.
- Headlight(color): Sets the two headlights on a specific color. The color can be one of the constants found in the BrainPad API or a hex defined color, like 0xF08000 for the BrainPad’s Orange color.
- Taillight(leftColor, rightColor): Sets the color of the tail lights.
- DistanceSensor(): Reads the distance in centimeters from the distance sensor located in the front of the robot.
- GroundSensor(): Reads the ground reflection sensors. A white (or black???) under the sensor will activate it. The returned values are covered below.
- InvertLeftMotor(): Inverts the direction of the left motor.
- InvertRightMotor(): Inverts the direction of the right motor.
|0||No reflection is detected.|
|1||Reflection is detected on the right sensor.|
|2||Reflection is detected on the left sensor.|
|3||Reflection is detected on both the left and the right sensors.|
You are ready to utilize the robot in any way you like, but we will not leave you on your own. Go ahead and start with making your robot dance.