Thymio mad cleaner
Solution
Click on the card to discover the solution
Here, we will use the states to know what to do regarding the situtions in which Thymio is.
In the beginning, Thymio is in the complete white state (all quadrants in white). The first line tells it to go forward as long as there is nothing in front of it. The line 2 and 3 will make it turn on itself for a given time when it reaches the border of the table. The line 4 will put it back in the start state (all white) and will make it go straight forward again.
When Thymio detects something in front of its or on its side, it changes state (all quadrant in orange) and push the object (line 5, 6 and 7). The lines 8, 9 and 10 will be used to stay aligned to the object and to avoid loosing it until it reaches the border of the table.
When Thymio will see nothing again, it means that the objects fell off the table (line 11). So Thymio stops and turns green. It will then wait for you to press the central button of the remote control to keep on its hunt! (line 12)
Share
Show us your results! You can share your own Thymio ambulance.
Click here to go to the creation section.