Page 1 of 1

Interrupting the movement?

Posted: Mon Nov 19, 2018 8:07 pm
by asperger
I currently purchased the AllCode and I am testing it in visual studio using C# as my language of choice.
Now, when I call the command:

FA_DLL.FA_Forwards(PortNumber, 100);

Then I want to stop the buggy as soon as it is near a wall. Setting Forwards to "0" doesnt work. It just keeps on moving until it reached the defined number of millimeters. Any advice?

Re: Interrupting the movement?

Posted: Tue Nov 20, 2018 11:06 am
by Steve
I can think of two ways around this:

1) Use a loop to repeat a set number of times (e.g. 20 times) and move a smaller amount within the loop, followed immediately with a check for a wall, and break out of the loop if the wall is detected.

2) Use SetMotor to set off driving and then continually monitor the encoders to determine how far you've gone (as well as keeping the buggy straight) at the same time as detecting for obstacles.

The first option should be a lot easier to implement though.