BrainGamer API

BrainGamer API

The provided driver allows users to control the BrainGamer controller without needing to understand advanced details.

Prerequisite

You must complete the BrainGamer Intro lesson first. This page is just a quick reference of the API. Skim through it quickly and jump into the next lesson.

Quick Reference

This page is a summary of the BrainGamer API drivers found in all programming language options.

  • Beep(): Generates a short sound on the buzzer.
  • SoundOn(frequency): Activates the buzzer at a specific frequency. Note that the buzzer is the one found on the BrainGamer (connected to P0).
  • SoundOff(): Turn the buzzer off.
  • ButtonUp(): Reads a button. 1 means it is pressed.
  • ButtonDown(): Reads a button. 1 means it is pressed.
  • ButtonRight(): Reads a button. 1 means it is pressed.
  • ButtonLeft(): Reads a button. 1 means it is pressed.
  • ButtonScanTime(second): A period of how long the button will be checked for press in the past (time machine!). It defaults to 0.25 allowing all button functions to return 1 if the button was pressed within the past 250 milliseconds.
  • RockerX(): Reads the Rocker X position. As the rocker sits in the middle by default, the returned value without any movement will be around 50.
  • RockerY(): Reads the Rocker Y position. As the rocker sits in the middle by default, the returned value without any movement will be around 50.
  • VibrateOn(): Activates the vibrator (haptic feedback).
  • VibrateOff(): Deactivates the vibrator.

What’s Next?

You are now ready to start making games with the BrainGamer. Start with making BrainGamer Pong game.

Newsletter

Twitter Feed
Hot off the press!
December 19, 2019
October 11, 2019
September 26, 2019
August 23, 2019
August 7, 2019
August 5, 2019