Use AFMotor Library



I’m creating a new extension that uses “AFMotor.h” library, but I don’t know how to add this library to Mblock 5.
In Arduino IDE I just put the AFMotor folder on the “Arduino/libraries/” directory and it works fine.
Someone could help me?



Hello @gsantos,
You need to upload the files in “Transcode Settings”, scrolling until the end of page.
Here a screenshot
When you upload and save the source files, the extension ship it and it is available for you in the block code.
Don’t forget include it where you use it in the form: “myCodeFolder/myCodeIncludeFile.h”



Thank you very much @ralcoberro,

My extension has stopped working even when I undo these settings :weary:

I tried everything, but I only get this message when viewing or downloading:



Hello @gsantos,
Sometimes it happens. Try sign out and sign in again and/or clearing cookies



Hello @ralcoberro,
Thanks, again.

The error from viewing or downloading the original extension remains, but I’ve created a new extension test to check and the viewing process works:

The library is not shown automaticaly on the “Include” option, but I put manualy and tested in different ways <AFMotor/AFMotor.h>, <AFMotor.h>, <AFMotor\AFMotor.h>, AFMotor/AFMotor.h, but the compilation doesn’t recognize the library:

Any tip?



Hello @gsantos,
You need to put it manually as you did but “double quoted”. In this case "AFMotor/AFMotor.h"

Best regards


Hi @ralcoberro,

Good news!
At the first time it was not working, but today I dowloaded again and it seems that there is a new version of MBlock. I put as you wrote and it worked fine :clap::clap::clap:

Thank you very much. I’ll publish my extension “8bots actuators”.


Hello gsantos, can you create a tutorial or screenshots on how you make your AFMotor extension. I’d like to make a motor controller extension for the L293d motor controller but am not clear on the sequence and steps when doing it with the extension builder.


Hi chonito,

We will have tutorials for similar extensions coming up these days. Stay tuned :grinning: