Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • First, edit your question, select all of your code, and tap the {} button to format it. Commented Jun 5, 2020 at 19:52
  • 1
    Also, you need to explain your goal more clearly. What should start your motor? The IR sensor? You say "I want the Motor to stop after one second as soon as the sensor detects the Obstacle." I don't understand what that means. You want it to run for at least one second no matter what, and after a second passes, have the IR sensor stop it if it detects and obstacle? Commented Jun 5, 2020 at 19:56
  • after one second” alongside “as soon as” is a contradiction. Commented Jun 5, 2020 at 19:58
  • 1
    Does Motor1.moveMotor(2.55*100); delay(1000); Motor1.moveMotor(0); work for you? Commented Jun 5, 2020 at 20:42
  • 1
    look at example sketches in the Arduino IDE ... look at the one named StateChangeDetection Commented Jun 6, 2020 at 18:52