Step 1:

Follow the Configuration instructions to connect your Quizbot to

Connect to your robot at the Robots page.

Start by playing with the sliders in the Drive tab. Figure out which one controls the servo that moves the head up and down.

Step 2:

In our example, the up-down servo is on Pin 4 (or the bottom slider). If yours is on the top slider, you can swap it in two ways:

You could physically swap the pins on the Arduino board.

Or, you could swap the order of the servos in the Configure tab. Click and drag one of the crosses on the left side and click "Configure" again.

Step 3:

Since the up-down servo is on Pin 4 on the Arduino we used, we will swap ours back for this example. Leave yours swapped if it is on Pin 3 on your Arduino.

Step 4:

Now switch to the Code tab.

You should resize your browser window so you can see all of the Code window.

Step 5:

Click "New" to create a new experiment. In our example we call it "nod_yes".

Step 6:

Next, use the "start" state to move the servos to the starting position.

For our example we set the up-down servo to 160 degrees and the left-right servo to 90 degrees.

Note: Keep in mind throughout these instructions that programming languages are extremely sensitive to typos. Be sure to follow the steps carefully and look out for small errors such as missing punctuation.

Step 7:

Save and run the experiment by clicking the Run button.

Your servos should now be centered so that your Quizbot is in its starting position, facing forward and up.

Your servos may be different, so if your Quizbot is not in this position, you may need to try other starting angles in the previous step.

Step 8:

Click the Stop button. Add a new state by clicking the Add State button. Name this state "nod".

Step 9:

In the "nod" state, set the up-down servo to a different angle to make the Quizbot nod. For our Quizbot, we used 90 degrees.

Step 10:

In the "start" state, add the command delay(1000). This makes the Quizbot pause in the starting position for 1 second (1000 milliseconds).

Below that, add the line of code state = "nod". This will change the state to the "nod" state.

Click "Run". The Quizbot should now wait one second in the starting position, then lower its head.

Step 11:

Click the Stop button.

In the "nod" state, add the command delay(1000). This will make the Quizbot pause in the "nod" state for one second.

Below that, add the line state = "start" to make the Quizbot return to the starting position after nodding.

Step 12:

Your code is now complete. Click "Run" to watch the Quizbot nod its head up and down. It will continue until you click "Stop".

Your code is saved whenever you click "Run", so you can open it again whenever you connect to this robot.


Can you make a new experiment named shake_no that shakes Quizbot's head no?

Next: Ask a Question