The following question is about a 3rd party Arduino programming enviroment mBlock and creating extensions for it. I hope that there are some of you out there, who are fammiliar with it.

I was recently making an extensions for mBlock that can be used to write code for Arduino, when I came over this obstacle. I tried to write a function inside the "work":"" statement.

It looked like this:

"work":"Serial.print("Hello world");"

The extensions could not be imported, due to the quotation marks around the Hello world string. I tried removing the quotation marks, the extension was sucessfully added, but the program did not work, beacause quotation marks are needed inside C++ code to define a string.

Is there a way to add them in the extensions, without screwing up the code?

1 Answer 1


If that is a JSON format you could try using single quotes instead of double quotes:

"work":'Serial.print("Hello world");'

Alternatively you could escape the internal quotes:

"work":"Serial.print(\"Hello world\");"
  • None of the mentioned solutions seem to work. The extensions still do not get uploaded. The extension I am writing has a .s2e extension, if that helps (I am not really familliar with these kinds of files).
    – user29519
    Jan 27, 2017 at 16:13
  • Looking at existing libraries the escaping should work. This is from serial.s2e: "work":"Serial.print({0});Serial.print(\"=\");Serial.println({1});\n"
    – Majenko
    Jan 27, 2017 at 16:19
  • For some reason it worked this time. I do not not why, but let's just go with it. Thanks.
    – user29519
    Jan 27, 2017 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.