Mblock 5 only supports number variables (mBot)


#1

In mBlock 5 any variable is created as a double (can hold float or integer)
image
generates
double aString;

In mBlock 3 the initialization could be used to cause the block-parser to insert a String instead. for exampleimage
generates
String aString;

While auto-type recognition is nice, as a mBlock My Block requires selection of parameter type, selection of variable type would be acceptable

Workaround (not for beginners)
Create blocks code with variables. BEFORE uploading, click on the </> in upper right to show the Arduino generated code, select all and copy, close the tab. Then above the code window, select Arduino C instead of Blocks, and paste. Then find your variable definitions, and for the Strings etc replace double with the correct type. Then upload to robot and it works correctly.


#2

Good comment. Will have PMs/engineers look into this.


#3

Thx for the workaround. It works for me in mBlock5. I’m surprised they haven’t addressed the variable type issue since the moment you add the Makers Platform LED Panel you really need some string variables.