How to program the Football Playing Robot.
Connecting electronic modules
1. Connect the motors to the M1 and M2 ports of the LOFI Brain. Make sure the small metal walls inside the pins of the motor cables are facing the plastic walls of the pins on the controller.
2. Connect the powerbank to the micro USB slot on the Adapter.
3. Connect the distance sensor to the corresponding slot on the Adapter. Make sure you have connected the pins VCC, TRIG, ECHO, and GND as shown in the picture below.
4. If you are using a Bluetooth module, connect it to the corresponding slot on the adapter. Make sure you put the module in the right direction, see the picture below.
The code
The left part of the script is responsible for the movement of our Football Player. Every cursor movement key is assigned for movement of the robot. The left column of the code is responsible for the goal celebration – pressing “Z” on your keyboard triggers flashing LEDs and beep sounds on the buzzer.