This is an example program for tug of war with two touch sensors. The game can be played with almost any robot, so we used: https://www.fllcasts.com/materials/265-five-minute-bot, because it is the simplest. You have to attach two touch sensors at ports 1 and 4, preferably with long cables. You can also add a color sensor to port 3, which will detect when to end the game, although this is not required. The game is simple, two human players click the touch sensors as fast as they can. The robot moves in the direction of the one that clicks the fastest and the goal is to bring it to your finish line.
The program teaches about counters and flags. A big part of it is the good names of variables and loops and the addition to plenty of comments, from which students can learn how to form their program.Download
- 21 Nov 2019