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?

In deze oefening brengen we samen wat we geleerd hebben van de Arduino met de motorcontroller, en de Afstandsensor HC-SR04.

Ties heeft het in onze werkplaats al een keer voorgedaan. Hij gebruikte de volgende onderdelen:

En daarbij had hij ook nodig:

  • laptop met Arduino IDE
  • soldeerwerkplek met temperatuur geregelde soldeerbout voor electronica
  • usb kabel
  • smeltlijm pistool

Geduldig heeft hij een paar versies gemaakt, en de laatste versie zie je op deze foto:

In de eerdere oefeningen hebben jullie de motor controller al eens aangesloten, en ook de ultrasone sensor. Als je dezelfde pin nummers hebt aangehouden als wij in deze oefening hebben gedaan, dan kan je beide oefeningen zo bij elkaar aan de Arduino monteren.

 

  • sluit de motor en de motor controller aan volgens schema
  • met de blink laat je de motor draaien
  • we leggen uit hoe een IF statement in C++ wordt geprogrammeerd
  • je combineert beide programma’s zodat je machine rijdt en op 10cm vanaf de muur stopt
  • Battle, stort niet in het gat. Tafel staat op 10 cm vanaf de muur. Teams racen naar het gat, maar stoppen zo dicht mogelijk bij de muur.

Uitdaging; je laat de auto naar een muur rijden en de auto moet op tijd stoppen. Hoe pas je nu het voorbeeld programma van de afstandsmeter aan, zodat de motor gaat draaien tot hij dichtbij de muur is?

Challenge: We zetten een tafel op een afstand van bijvoorbeeld 10 centimeter van de muur. Lukt het je om zo dicht mogelijk bij de muur te komen zonder in het gat te vallen?