Finding a black dot with IR sensor

Hey everyone, for a school project I have to build a autonomous car which is able to find a black dot on a white road. So my thought was to use an infrared sensor. But how do I do this?

I have no idea about the code nor the circuit

Please help me ^^

what are your high level thoughts? start decomposing the pb in smaller parts

The thing the sensor has to do:

Just scan the ground beneath the car, all white.
When the sensor finds the black circle, in the middle of the road, The has to be made stop and after a couple of seconds, go back on track again, from that point the IR sensor is not longer needed.

So it needs to find the circle then make the car stop.

Good so you know you need as part of the loop

  • something that gets the car moving
  • something that check a color sensor
  • make decision about the movement based on the sensor reading.

Code you can start working on:

  • write a small program driving a color sensor which prints something when the color under the sensors changes to black. no need to attach the sensor to a robot, just have a piece of white paper with a black dot and move the paper underneath the sensor and see if that works fine.

  • write a small program that gets your car robot moving straight, turn right, turn left and stop.

Unanswered Questions=

  • what does the field you need to explore look like? straight road (like a line) or an area? is it flat, bumpy? how do you handle scanning the full terrain?