DUE BrainGamer Intro

BrainGamer Intro

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

Software driver (library) is provided to start using BrainGamer with minimal needed knowledge. Future gaming lessons cover details on using the driver.

The driver provided below needs to be copied to to the bottom of your BrainGamer projects.

#####################################
###       BrainGamer Driver       ###
### YOUR CODE GOES ABOVE THIS BOX ###
#####################################
###   variables used by driver    ###
###         x,y,u,d,l,r           ###
##################################### 

Exit
### Rocker ###
# Reads the rocker position into x and y
@Rocker
x = ARead(4)
y = ARead(3)
Return

### Activate Vibrator ###
@Von
DWrite(8,0)
Return

### Deactivate Vibrator ###
@Voff
DWrite(8,1)
Return

### Read Keypad ####
# Reads the 4 buttons into U,D,L,R
@Keys
u = DRead(14,1)
d = DRead(15,1)
l = DRead(13,1)
r = DRead(16,1)
Return

Using the BrainGamer is now done easily.

Rocker()
PrintLn(x,y)

The immediate window can also be used to control the robot. Immediate commands must be a single line but can have multiple instructions. The following code is exactly the same as earlier code, but on a single line.

Rocker():PrintLn(x,y)

The buzzer is not added in the driver. It can simply be accessed using the Sound feature on pin 0.


What’s Next?

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

Content Licensing
Newsletter

Twitter Feed
Hot off the press!
January 30, 2024
December 14, 2023
December 11, 2023
December 8, 2023
November 24, 2023