Infrared (IR) Ground Contact

If you haven't already familiarised with your IR Feet sensors, please visit our article on 'Obstacle Sensing' first.

On the front of your Marty V2's feet you will either have:

  • 2 'Infrared Foot' sensors (1 sensor on each foot)


  • 1 'Infrared Foot sensor' on Marty's right foot and a 'Colour Sensor' on Marty's left foot (the colour sensor has an IR sensor built-in).

Note: If you want to use the ground sensing with the Infrared Foot sensors you will need to loosen the screws slightly and slide the plastic 'shield' insert out from underneath the sensor. This shield needs to be in place when you use the IR obstacle detection but for ground sensing it must be removed.

This is what the plastic insert under the IR sensor looks like:

This is how you loosen the screws on the sensor:

This is the IR foot with the plastic insert having been removed:

Using IR Ground Sensing in Scratch

You can learn to use the Ground Sensing in our free online lesson here!

Like the IR obstacle detector, your IR ground sensor will return 'true' or 'false': this time it will say 'true' if a surface is detected below the foot or 'false' if there is no surface detected below the foot.

This is useful if you want to create some code that tells Marty to stay away from edges of a table, this might look like the picture below in Scratch: