Mblock 5 custom Arduino blocks - upload .h .cpp files


#1

Hi, I’m trying to create custom Arduino blocks using the Extension Builder. For one of these blocks, I want to upload some custom include files so I don’t have to put all of the code into the transcode of the block. Is there a way to upload custom “.h” and “.cpp” files that can be bundled into my extension?
Thanks in advance!
-Chris


#2

I also connect to the question


#3

It can be done.
IN Transcode settings add Source file


#4

I thought that only allowed JavaScript files?


#5

Okay, it looks like Transcode->Add Source file only allows you to pick an entire directory, not single files. So I was able to upload all of my .cpp and .h files. However, when I try to include them in my program I get an error:
Command failed: avr-toolchain/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"/docker-ext/Arduino-server-test/src/external/arduino/avr-library/variants/standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" “/root/mblock-avr/temp/build/code.cpp” -o “/root/mblock-avr/temp/build/code.o” /root/mblock-avr/temp/build/code.cpp:16:28: fatal error: src/HyperDuino.h: No such file or directory compilation terminated.

It’s weird because it uploaded the files using the name “src” as the directory because that was the name of the directory on my computer. But I don’t know how to #include those files in my block code. I tried doing:
#include “src/HyperDuino.h” but that gave the above error.

Is there a way to upload just individual files, with no directory prefix? Or if not, how do I #include them in my block code?
Thanks!


#6

Hi gorthmog

Device plugin is set here:


And here is for setting extensions plugin:


#7

Hi, I don’t understand this reply. I am trying to include extra files within my transcode for my blocks. I want to upload a header file called HyperDuino.h. In my block transcode, I need to be able to include this header file, like this:
#include “HyperDuino.h”

I don’t know how to upload a single file (it doesn’t work) and I don’t know what “path” to use when including the file.
Thanks,
Chris


#8

Hi Chris,

We have consulted the engineer about this issue. After you upload the .h and .cpp file, you need config arduino here to make it take effect:

The header file reference path is: if the .h .cpp file is in the src directory, the reference method is #include “src/example.h”


#9

Okay, that worked! Thanks!

My next question: Is there a way to upload the files so they do not have to be in a subdirectory? In other words, I want to upload individual .h and .cpp files and just be able to do:
#include “myfile.h”

Instead of #include “mydirectory/myfile.h”

Thanks!
-Chris


#10

That should be ok, you can add your own individual files.


#11

Hello,
I need to upload several files (.h and .c) for a display control.
I can Upload the files using the extension builder (Transcode Settings->Add Source File) but it fails when I “Save” returning “Save Failed”
It only Fail when I Upload around 50 files. If I Upload 10 files it works fine.

I will appreciate your help
Regards
Rodrigo


#12

Hi Rodrigo,
Actually we don’t have the limitation for file size or file number. May I know your application that requires 50 files?
Will you kindly send us the files and other related information, we’ll have a test. Here is my email: stephanie.wu@makeblock.com
Thank you!


#13

Hello @tech_support,
Ok, Could be a “timeout” saving a large file number may be??
It is the “U8glib-1.19.1” for led display writting. I will send a e-mail with the library.
Which is the better way for library uploading?
Just the plain .c/.h files or a precompiled lib?

Thak you
Rodrigo


#14

Hello Rodrigo,
There should be no much difference between them. Have you tried both?
I have forward your library to the tester and will email you later the result. Thank you for the patience.


#15

Hello @tech_support,
I think is necesary to upload .h headers because they are needed for compiling.
Any advance in the problem research?

Best regaeds
Rodrigo


#16

gorthmog it looks very much like your mistake
can you help me with this.

I tried something, but I can not understand.


a few settings

I want to use this library Firebase-ESP8266-master.zip (153.3 KB)


#17

Hi, I can’t remember all of the details, but it looks like I needed to add that “arduino” middleware. See the reply from the tech_support engineer. Here is their screenshot:


Best of luck!


#18

same place but different

can this be the current version later?


#19

You are talking here. this is exactly how you did it is my problem i think how should i do this


#20

I had to do:
#include “src/myfile.h”
-Chris