Line following and obstacle avoidance Ultimate 2.0


#1

Still a beginner at programming and I’m kinda stuck. The robot would just push the obstacle with it and not go back to follow the line (It’s supposed to follow a white line)

This is what I have so far…

Help please-


#2

Because of the “Wait 0.5 seconds” block, the code cannot continue to run until the 0.5 seconds are expired. So, the mBot Ultimate can’t continue with its other codes until the 0.5-second delay is over. (This is because mBot Ultimate is based on an Arduino, which can’t multitask).

There are workarounds for this problem. If you’d like me to send you one, please let me know. :grinning:


#3

Wait really :0? Can you send one please?


#4

Sure! It may be a couple of days for me to make it, I’m really busy! :wink:


#5

This is what the code looks like, if you want the file I can send it to you:
image


#6

Can you send it via Google Drive, please?


#7

Sorry, I don’t have a Google Drive:
https://share.internxt.com/d/sh/file/9401f6ee605f1c595afd/bc993beb9abc5d9d3ad2271ae9662849e64dd77fe2d3b2cd41ee13c4af50df81

You can download that and open it in mBlock.


#8

Arduino can’t multitask but you can use non blocking programming(with Millis())
You might have to scroll down a lot for this one:



#9

I know, I have made myself a personal extension in mBlock that does this.