Bad mistake in Arduino library



I just tried to write individual programs using mDrawBot Kit with mBlock.
Nothing worked like it should. Analysing the generated Arduino Code I found that there is a Mistake in one of the libraries.

When I, in mBlock, insert the Block "Set Delta to atan of x/y"
it will, in Arduino Code, translate to delta = atan(angle_rad*(y) / (x));

But it should translate to delta = angle_rad*(atan(y) / (x));

I get the same issue using acos and asin functions. Fixing is only possible over the Arduino IDE.

As this is very inconvenient I hope you find a way to update the library.



Hi @atz,

I’d say it is more likely an error in the code generator (which is responsible for generating the C code for the Arduino environment). Regardless, it does need to be corrected. What version of mBlock are you using and on which operating system? This is information that @tec_support will need to help you.

Best regards,



Hi Chuck,

I am using the Windows 3.4.8 Version of mBlock and the 3.4.3 Version on Mac. The mistake is the same.
But I myself made a mistake:

“set a to atan of b” should translate to
a=atan(b); if you want the result in radians and
a=angle_deg*atan(b); if you want the result in degrees.

Meanwhile I also found a workaround in Scratch:
“set a to atan of (b/angle_rad)” or “set a to angle_deg*atan(b/angle_rad)” if you want degrees.

Best regards


Good to hear that you found a workaround, but it’s still a bug in the code generator. Have you tried mBlock 4.0 to see if it still persists?


I tried the function on mBlock 4.01 on my Mac. It is still the same.


Hi atz,

We have provided feedback of this issue to our engineer.
Thanks for your feedback!