Discuss Scratch

jaltekruse
Scratcher
2 posts

Basic prototype of a scratch to C++ converter and a game running on an Arduino

Hello Scratch community!

I have been taking an interest in computer hardware and I have been teaching a class about building DIY video game consoles using Arduino boards and the open source Arduboy schematic. I am hoping to create a follow up class about programming games, and I thought Scratch would be a good platform to work off of, as I'd like to keep the class accessible to people new to programming, just as the hardware class is friendly for total newbies.

I have an initial working prototype of a conversion script that can take a Scratch game and convert it into an Arduino C++ project.

I made a post over in the Arduboy forum about this, and you can see on that page the converted game running in the simulator, it also runs fine on the Arudino hardware.

https://community.arduboy.com/t/first-arduboy-game-programmed-with-scratch-and-expanding-educational-use-of-the-arduboy-platform/12784

https://www.youtube.com/watch?v=I_avibps9TQ

Last edited by jaltekruse (Sept. 18, 2025 21:29:10)

scratchcode1_2_3
Scratcher
1000+ posts

Basic prototype of a scratch to C++ converter and a game running on an Arduino

bump
cheddargirl
Scratch Team
1000+ posts

Basic prototype of a scratch to C++ converter and a game running on an Arduino

Hi jaltekruse, just giving a heads-up that I moved your topic over from “Show and Tell” to “Connecting to the Physical World”, it seemed like a better fit there since it involves the use of Arduino.
pishi-ai
New Scratcher
23 posts

Basic prototype of a scratch to C++ converter and a game running on an Arduino

That’s really interesting! Translating Scratch blocks directly into C++ for Arduino is a cool approach — it bridges visual logic with real code.
In Pishi.ai Scratch, we’ve taken a slightly different route: it connects to Arduino through the Firmata protocol, so blocks can control hardware live (no compile step needed).
It’s super useful for teaching beginners how inputs, outputs, and sensors work before they move on to writing C++ themselves.

What also makes this kind of environment powerful is how it combines with AI extensions — like FaceMesh for face and movement detection, or image and text recognition.
These AI features add a whole new layer of creativity to Scratch projects that can’t easily run directly on Arduino hardware itself, but work great when both sides (AI + board) collaborate.

Your idea of compiling block logic directly to C++ could be a great next step for learners who already understand the basics.

move scratch (a lot of) steps ahead by pishi.ai scratch
jaltekruse
Scratcher
2 posts

Basic prototype of a scratch to C++ converter and a game running on an Arduino

Hello!

It took more work than I expected, and it definitely still has bugs, but I present the first public release of my Scratch to Arduboy C++ converter!

https://www.youtube.com/watch?v=VNvBJx95JAQ

The current version has a good amount of duct tape holding it together, definitely don't expect everything you can do in scratch to work. The scratch team even pushed an update in the last week or so that broke something in my conversion script! I haven't been able to hunt down a root cause for that, I just took that feature out of my demo game, so for now you can't use custom blocks yet.

Here are three scratch games that can be converted and run to some level of accuracy.

https://scratch.mit.edu/projects/1172629187/
https://scratch.mit.edu/projects/1272213324/
https://scratch.mit.edu/projects/1313371488/

You can play the converted demo games on the Arduboy simulator here: https://community.arduboy.com/t/first-arduboy-game-programmed-with-scratch-and-expanding-educational-use-of-the-arduboy-platform/12784/4

The Arduboy cloud editor
https://cloud.arduboy.com/

Last edited by jaltekruse (Yesterday 14:01:25)

Powered by DjangoBB