Electronics part 4: Arduino code guide

The provided code handles a complex workflow. It tracks the position of the mouse and provides positional feedback and rewards. This process requires several external components which are set up at the start of the script. If errors arise, it's most likely within this section.

For debugging you need to implement several print messages and check which get outputted and which not.

Test run

You can test the functionality by moving the platform until the prints state to be in the reward lane. These prints are always enabled.

Capacitive sensor MPR121

Test Pixycam2

Adjust pixel values in code

Depending on the position of your camera you need to adjust the pixel values for the tracked platform in the code.

Linear actuator


Previous page