I created an Arduino drawing robot for a workshop to help teen girls get interested in STEM topics (see https://www.instructables.com/id/Arduino-Drawing-Robot/). The robot was designed to use Turtle-style programming commands such as forward(distance) and turn(angle) to create interesting pasterns.

During the workshop, we used the "Anna and Elsa" tutorial from the Hour of Code to help the participants become familiar with programming in preparation for programming their robot. The tutorial uses graphical programming blocks to help avoid the roadblocks of typing and syntax, but the equivalent JavaScript code can be viewed, creating a powerful bridge to learning a commonly used and powerful programming language.

Our discovery was that since the tutorial used a similar commands for moving Anna around the screen, and that JavaScript's formatting structure is very similar to Arduino C code, that drawing patterns could be created and tested in the browser, and then the generated JavaScript code copied and modified to drive the robot in Arduino! Using code to control something in the physical world is an engaging demonstration of the power of programming.

Step 1: Hour of Code Tutorial

Both the "Anna and Elsa" and the "Artist" Hour of Code tutorials use commands like "move" and "turn" to move the characters around the screen. As the tutorial progresses, you learn the power of loops and nested loops. In step 12 of Anna for example, you use nested loops to create a snowflake patern. At the end of the tutorial, you are given a blank slate to experiment with.

<p>Wow, this is a really interesting instructable! Very useful, because it can help make the step from programming in hour of code towards using hardware.</p>
<p>Does the Arduino hour of code INO work with the PRO Trinket as well or does the code need to be modified?</p>
<p>good one ...</p>
<p>Very nice.</p><p>it will be fun to draw what have been done in hour of code tuto.</p><p>just one thing.</p><p>in the .ino file you don't use : jumpForward()</p><p>this fonction is use by ana and elsa for jump.</p><p>is it :</p><p>void jumpForward(float distance){</p><p>penup;</p><p> backward(distance); </p><p>pendown;</p><p>}</p><p>thanks for this tuto.</p><p>karl</p>
<p>Totally forgot about jumps! Good catch. I'll add that.</p>

About This Instructable




More by MakersBox:Easy Joule Thief Soldering Project Using an Arduino Drawing Robot with Hour of Code Tutorials Arduino Drawing Robot 
Add instructable to: