In this exercise, we bring together what we learned from the Arduino with the motor controller and the Afstandsensor HC-SR04.

Ties already did it once in our workshop. He used the following parts:

And he needed that, too:

  • laptop with Arduino IDE
  • Soldering workstation with temperature controlled soldering iron for electronics
  • USB cable
  • hot-melt adhesive gun

He patiently made a few versions, and the latest version is shown in this picture:

In the previous exercises, you already connected the motor controller, and also the ultrasonic sensor. If you kept the same pin numbers as we did in this exercise, you can mount both exercises together on the Arduino.

  • connect the motor and the motor controller according to schedule
  • with the blink, you let the engine run
  • we explain how to program an IF statement in C++
  • you combine both programs so that your machine drives and stops at 10cm from the wall
  • Battle, don’t fall in the hole. Table’s 10 cm from the wall. Teams race to the hole, but stop as close to the wall as possible.

Challenge: you let the car drive to a wall and the car has to stop in time. How do you adjust the example program of the rangefinder so that the engine starts running until it is close to the wall?

Challenge: We set a table at a distance of, say, 10 centimeters from the wall. Can you get as close to the wall as possible without falling into the hole?