How to show Scratch code converted to Arduino C?


#1

Hi folks,

Just starting out - in Arduino mode, should mBlock be auto-translating my Scratch code in the middle pane into C shown in the right pane? Or am I expecting too much? For me this isn’t happening - the right pane only ever shows some very basic ‘move’ code. Instead is it the case that one either programs in Scratch or in C and the ‘Upload to Arduino’ button will upload whichever pane was last edited in?

Thanks for any pointers on this,

Ian


#2

Hi diem,

The mBlock upload to arduino panel generate the arduino code (code in program void setup() { } or void loop () { }) corresponding to graphical program in real time.
Here is a document introducing the mBlock software to you for reference.


#3

Thanks for the rapid reply! I’ve read through the getting started guide but still have questions.

Is it correct that:

  • the Scratch code is only converted to Arduino C when the ‘Upload to Arduino’ button is pressed?
  • the C code shown in the Arduino mode pane is never updated to match the Scratch code?

To put it another way, is there any way to see what the Scratch code looks like when converted to Arduino C? Other forum posts seem to suggest this is possible but I can’t work out how to do it.

Thanks,

Ian


#4

If you start your program with one of the robot hat blocks (mBot Program, etc.), the corresponding C code will be updated as you add/remove/modify blocks. If you are using the Green Flag start program hat block from the Events palette, no code will be generated.


#5

Thanks Chuck!

That was what I was missing.

Cheers,

Ian