Code Blocks Powered by Scratch Blocks Now In Tinkercad!

We’re very excited to share a preview of our latest Tinkercad Circuits feature: Code Blocks powered by Scratch Blocks!


Code blocks let you program Arduinos using drag-and-drop blocks.  The blocks allow you to automatically build the text-based code in real time, so you can see exactly how Arduino code is formatted and then easily export your sketch to upload directly to an Arduino board. Check out the example below, where just two lines of block code help generate almost 30 lines of code!

Two lines of code blocks = 30 lines of text!


Code blocks build the loop() function in your Arduino program.  This means that if you choose to read a sensor or write to an output, we’ll automatically add all of the necessary setup parameters for you!  As an example, try dragging out the set built-in LED block and notice how the corresponding pin is set as an output in your setup function.  We even add any libraries you need – check out how dragging out the rotate servo block automatically adds the servo library to your code.

Our preview includes blocks for playing speakers, controlling servos, reading ultrasonic distance sensors, and more.  We’ll be adding even more blocks in the near future.

To get started with Code Blocks, head over to your dashboard, click on Circuits, and click the Create Circuit button.  When you have the Circuits editor open, drag out an Arduino and click the Code Editor button.  There, you’ll automatically see the Code Blocks and default code to turn the built-in LED on and off – click the Start Simulation button to test it out!

Creating a new Circuit Design

Many of our starters also include Code Blocks.  To test out these pre-made circuits, click on the Components Button, select the Starters tab, and choose something under the Arduino section to start tinkering (I recommend the Servo starter!).

If you’re looking for some ideas for projects to build, here are some examples to get you well on your way to coding with code blocks:

Programming a servo
Building an alarm
Building a temperature mood light

We’re looking forward to seeing how you use Code Blocks to build awesome things with Arduino.  Happy Tinkering!