Getting Started on Tinkercad (skip this if you’ve completed it previously) 1. Go to tinkercad.com and click the green Join your class button.
2. Enter the class code (KNRMQXCFCCSU) when prompted.
3. Enter your first name in the Nickname field. Once you log in, anything you create will be visible to
your instructor for grading purposes.
Copy a Default Circuit 1. After logging into the class, go to https://www.tinkercad.com/things/bUvkxh7RYr8 and click the
Copy and Tinker button. The circuit used for this assignment will automatically be copied to your
personal dashboard and your code will be visible to your instructor.
1
The notes on the circuit can be expanded and will explain what each part is. Program the Arduino 1. Click the Code button at the top right of the Tinkercad window. The code pane will slide out. (See
Figure 1, below.)
Figure 1: The default Tinkercad view. The code pane can be accessed by clicking the Code button in the red box; the Start Simulation button runs the code. 2. In the pane that slides out, click the Blocks dropdown and select Blocks + Text. This will allow
you to see both the Scratch code and the Arduino code (which is generated by the Scratch code
automatically). See Figure 2 for more clarification.
3. Click the fuchsia Variables option in the top left of the code pane and then click **Create variable. . . *.
Name your new variable sensorValue.
A variable is a place to store data and will be used as a placeholder in the code for the actual data. 4. Find the module that says set [sensorValue] to [0] and drag that block into the Scratch Code area. Place it right under the first comment block.
5. Now, link the variable to the input read on pin 0. Go to Input (purple) and choose read analog pin
[A0]
. Drag this to where the 0 is in the set block. (Note the shape is the same.)
6. Connect the second comment block to the bottom of the set block.
2
Figure 2: The coding pane of Tinkercad. Code is modified by dragging blocks from “Scratch Functions” to “Scratch Code”; the Arduino Code is generated automatically. 7. Go to Output (blue) and drag print to serial monitor [hello world] [with] newline into
your code.
8. Find the variable sensorValue under Variables and drag it into the oval in print to serial
monitor
.