Home Forums Crumble Support Distance Sensor- variables

This topic contains 3 replies, has 4 voices, and was last updated by  MrShaunL 1 day, 10 hours ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #4195


    I would like any advice on how to programme the distance sensor…. I am trying to programme the motors to stop if they are 5 cm from any object!! HELP



    Are you using the most current version of crumble software?



    Have you tried something like this?

    (I assume you know how to connect the sensor)


    You must be logged in to view attached files.


    I’m having an issue with the distance sensor too.

    My issue is that when I try to run 2 motors simultaneously, the distance sensor reading drops down to 0. So my program to make the buggy turn when it gets close to a wall triggers a turn constantly.

    I know my wiring is correct and my code is correct, as I have tested everything. Disconnecting power to one of the motors gives me accurate distance sensor readings but as soon as both are running, the distance sensor fails again.

    It might be that my motors are drawing too much power (I’m using modern medium sized lego technic motors at the moment ) – when I can obtain some other motors I may try again.

    At the moment a crude work-around is to have the buggy stop and re-check the distance whilst stationary, but it makes for very juddery progress…

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.