Ties already did it once in our workshop. He used the following parts:
- a 9 volt battery
- connection piece for 9 volt battery
- HC-SR04 ultrasonic sensor
- Arduino Nano
- LN298N mini motor controller
- motor with plastic gear, 3-6 volts or 3-12 volts https://nl.aliexpress.com/item/4000226014866.html
- additional wheels https://nl.aliexpress.com/item/32828057757.html
- jumper wires, tie-wraps, double-sided tape
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?