mBot line follower with mblock-blockly


#1

I am working on an iPad Air 2 os version 15.8, mBot-K01-02. I have tried the line follower code, see example attached. The line follower ist connected to port 2, I have testing the slots with lights only and it works I can identify the values (0 on track, 3 off tract … ) but it seems not to work very well, for instance it stays on track for a few second then lost the track …


#2

I have also tried to put some wait conditions but still same issue, the mBot does not stay or follow the track.


#3

oops sorry, I keep testing different app, this time I am going to stay on mBot only!


#4

@royam0820 I’ll try to get you an example code later this week. I’m quite busy, sorry. :grimacing: Maybe @CommandeR has something.


#5

Thanks! it is really frustrating, I have tried different code but none worked perfectly, way back then the test was pretty straight forward based on the sensor line follower on port 2, using embedded if-then-else

  • if value = 0 move forward

  • if value = 1 turn left, wait 0.02 sec

  • if value = 2 turn right, wait 0.02 sec

  • if value = 3 move backward

I have tried motors, testing black line, and white line with no success …
Of course I have tested the line follower values and they are correctly displayed.

Many thanks for your help and support.


#6

From the code above, only the move forward and backward worked !


#7

@royam0820 Alright, thanks for the info. I’ll try to see what I can do later. Good luck!


#8

Thank you so much!


#9

@royam0820 No problem! Let me know if you need anything else.


#10

for sure ! Thanks :wink: I now need to test the button pressed event and the remote control. I had codes for all that in previous mBlock version on laptop, trying to replicate that on the ,mBlock ipad version.


#11

Using the mBlock application on my latptop 5.4.3 on a macOS. I have coded the following code


Once the code uploaded successfully to the mBot arduino board, the code works fine, ONLY if the mBot remains connected to the laptop USB port. and is disconnected from the application. If I remove the USB cable and try to test the mBot on its own, I can’t, the mBot is completely shut off. Can you please help me! code works really fine if I leave the mBot connected to its USB cable. I have tried firmware re-initialization, and re-connecting, re-uploading the code but yet the same issue occurs.

Weird! can you help me.


#12

Well, I’m SUPER busy right now. Sorry, I will help you when I can. Good luck!

@royam0820
@CommandeR


#13

Hello

Ok not to worry! I have just redone the settings and connections and now the code is fine by itself.

Thanks for your support


#14

:slight_smile: OK, thanks!


#15

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.