Arduino C code disappear if I place the block under another one


#1

Need HELP!! THANK YOU!!~

If I only drag out my customized block, the Arduino C code is fine.

However, If I place the customized block right below any other blocks, for example, this wait block or the head, their Arduino C code don’t combine together.

Does anyone why this happens? what should I do to fix it?

Thank you!!


#2

If I just drag out two blocks, and don’t combine them, I get the correct Arudino C code.

However, If I combine the blocks, I only get the Arduino C code for the top one.


#3

Hi jxsun,

From my understanding, code block normally would only be transcoded once attached to the event block (which is used to trigger the execution of other code block, such as “when XXX start” or “When XXX is pressed”). Therefore, for other kinds of blocks, you don’t need to have them transcoded when dragged into the script area. But in your case, the code blocks are transcoded. So I assume that you have somethings checked up in the setting page. You probably have done this:

You have the selection ''Default transcoding for scripts in combination with this block" marked up. This will automatically transcode the block without waiting for the attachment of event block, and might affect transcoding of other blocks behind it. And that’s why in your second case, the second block’s code disappear when attaching to the first block.

Therefore, I suggest you to deselect ''Default transcoding for scripts in combination with this block";

By the way, if you indeed want to create an event block in the future. Don’t forget to select 'Default transcoding for scripts in combination with this block". Besides, you need to do another thing to make sure codes of its behind blocks being successfully placed at a right position:

you need to add / *{BRANCH} * / in the “code” area as a placeholder for the upcoming transcoded code.

Best,

Allen