How to know if encoder motor is moving


#1

Hi,

In my project, I have an encoder motor which move in a direction, and at a point he we’ll find an obstacle. When it arrives, I want him to stop (but I don’t want him to avoid this obstacle, just to stop when he hits it).
Do I have a way to do it without some distance sensors ?
Is there a way to detect if the motor the axe of this motor is still moving forward ?
I didn’t find any function that corresponds to this situation.

Thank you for any help.


#2

One approach is to use a touch sensor that is based on a momentary contact switch. Unfortunately, Makeblock doesn’t make one of those at this time.

I haven’t tried this (yet), but if you are using the mBot Ranger or Starter kit which are based on the Auriga, you might try using the reporter blocks for the speed/rpm or position to monitor whether or not the motors are turning. Just a thought.


#3

That’s agood idea, I’m going to see if I can use a switch.

I’m not sure I understand, what are the “reporter blocks” ?

Thank you for your answer.


#4

Reporter blocks (Scratch terminology) are the rectangular blocks that have rounded ends. Their function is to perform a read operation on a sensor and “report” the value. :slight_smile: