Circuit Playground Quick Draw

Similar documents
Circuit Playground Express Treasure Hunt

Arduino Lesson 1. Blink. Created by Simon Monk

A - Debris on the Track

A - Debris on the Track

A - Debris on the Track

Overview. Overview of the Circuit Playground Express. ASSESSMENT CRITERIA

Ok, we need the computer to generate random numbers. Just add this code inside your main method so you have this:

Capacitive Touch with Conductive Fabric & Flora

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

Circuit Playground Sound-Controlled Robot

Lesson 3: Arduino. Goals

Adafruit 16-Channel Servo Driver with Arduino

C# Tutorial Fighter Jet Shooting Game

Montgomery Village Arduino Meetup Dec 10, 2016

Adafruit SGP30 TVOC/eCO2 Gas Sensor

D - Robot break time - make a game!

Analog Feedback Servos

Adafruit 16-Channel Servo Driver with Arduino

Microcontrollers and Interfacing

Spy Theme Playback Device

Adafruit NeoPixel Library Documentation

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

FABO ACADEMY X ELECTRONIC DESIGN

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

TWEAK THE ARDUINO LOGO

INA169 Breakout Board Hookup Guide

Sipping Power With NeoPixels

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

Adafruit 16-channel PWM/Servo Shield

Welcome Show how to create disco lighting and control multi-coloured NeoPixels using a Raspberry Pi.

Overview. The Game Idea

RGB LED Strips. Created by lady ada. Last updated on :21:20 PM UTC

HC-SR501 Passive Infrared (PIR) Motion Sensor

Arduino Sensor Beginners Guide

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

Nixie millivolt Meter Clock Add-on. Build Instructions, Schematic and Code

Once this function is called, it repeatedly does several things over and over, several times per second:

CPSC 226 Lab Four Spring 2018

Yihao Qian Team A: Aware Teammates: Amit Agarwal Harry Golash Menghan Zhang Zihao (Theo) Zhang ILR01 Oct.14, 2016

APDS-9960 RGB and Gesture Sensor Hookup Guide

Let's Race! Typing on the Home Row

Interactive 1 Player Checkers. Harrison Okun December 9, 2015

Candidate Instructions

Class\lane pm pm 0 9 (the second distribution is lost)

Adafruit 16-channel PWM/Servo Shield

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

Adafruit's Raspberry Pi Lesson 8. Using a Servo Motor

Annex IV - Stencyl Tutorial

EdPy app documentation

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Explore and Challenge:

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

EE 307 Project #1 Whac-A-Mole

Some prior experience with building programs in Scratch is assumed. You can find some introductory materials here:

PROJECT REPORT STUDY WEEK "FASCINATING INFORMATICS" Game Platform Mastermind. Abstract. 1 Introduction. 1.1 Mastermind Game Rules

CONSTRUCTION GUIDE IR Alarm. Robobox. Level I

Add Rays Of Sunlight To A Photo With Photoshop

COMPUTING CURRICULUM TOOLKIT

Programming Exam. 10% of course grade

Adafruit 16-Channel PWM/Servo HAT for Raspberry Pi

Creating Accurate Footprints in Eagle

Input from Controller and Keyboard in XNA Game Studio Express

Key Abstractions in Game Maker

On the front of the board there are a number of components that are pretty visible right off the bat!

Assignment 5: Yahtzee! TM

Before displaying an image, the game should wait for a random amount of time.

In this project you ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds.

Assignment #5 Yahtzee! Due: 3:15pm on Wednesday, November 14th

Welcome to Arduino Day 2016

HW4: The Game of Pig Due date: Tuesday, Mar 15 th at 9pm. Late turn-in deadline is Thursday, Mar 17th at 9pm.

Lets start learning how Wink s bottom sensors work. He can use these sensors to see lines and measure when the surface he is driving on has changed.

Tutorial: A scrolling shooter

Setup Download the Arduino library (link) for Processing and the Lab 12 sketches (link).

Implementing Fast Telemetry with Power System Management Controllers

THE INPUTS ON THE ARDUINO READ VOLTAGE. ALL INPUTS NEED TO BE THOUGHT OF IN TERMS OF VOLTAGE DIFFERENTIALS.

Grove - Collision Sensor

Trinket Powered Analog Meter Clock

Heating Pad Hand Warmer Blanket

Ghostbusters. Level. Introduction:

Contribute to CircuitPython with Git and GitHub

Space Invadersesque 2D shooter

Objective of the lesson

G51PGP: Software Paradigms. Object Oriented Coursework 4

ServoDMX OPERATING MANUAL. Check your firmware version. This manual will always refer to the most recent version.

Mathematical Talk. Fun and Games! COUNT ON US MATHS CLUB ACTIVITIES SESSION. Key Stage 2. Resources. Hints and Tips

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

CSE 260 Digital Computers: Organization and Logical Design. Lab 4. Jon Turner Due 3/27/2012

Girls Programming Network. Scissors Paper Rock!

3D Printed NeoPixel LED Gas Mask

Adafruit 16-Channel Servo Driver with Arduino

Programming 2 Servos. Learn to connect and write code to control two servos.

Consult the Standard Lab Instructions on LEARN for explanations of Lab Days ( D1, D2 ), the Processing Language and IDE, and Saving and Submitting.

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

Cardboard Box for Circuit Playground Express

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

Operating Mode: Serial; (PWM) passive control mode; Autonomous Mode; On/OFF Mode

Figure 1. Digilent DC Motor

Application Note AN 102: Arduino I2C Interface to K 30 Sensor

URM37 V3.2 Ultrasonic Sensor (SKU:SEN0001)

Transcription:

Circuit Playground Quick Draw Created by Carter Nelson Last updated on 2018-01-22 11:45:29 PM UTC

Guide Contents Guide Contents Overview Required Parts Before Starting Circuit Playground Classic Circuit Playground Express The Town Clock Game Design Game Logic Player Buttons Countdown NeoPixels DRAW! Player NeoPixels PLAYER 1 MISDRAW! PLAYER 2 MISDRAW! PLAYER 1 WON! PLAYER 2 WON! Arduino Randomest Random Random Isn't Random The Countdown Show Outcome Code Listing CircuitPython The Countdown Show Outcome Code Listing Questions and Code Challenges Questions Code Challenges 2 3 3 3 3 3 4 5 5 5 5 6 6 6 7 7 7 9 10 10 14 15 17 19 20 21 23 25 25 25 Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 2 of 25

Overview You know the scene. Old West town. Two gunslingers face each other on a dusty street. Tumble weed rolls by. Everyone is eying the town clock. Tick. Tick. 'Cause when it strikes high noon, the gunslingers...draw! Pew! Pew! Who was the Quickest Draw? Well put your guns away pardnah. Let's just use these two buttons we got here on our Circuit Playground. This here is a two person show down game to see who can press their button the quickest. Required Parts This project uses the sensors already included on the Circuit Playground, either a Classic or an Express. The only additional items needed are batteries for power and a holder for the batteries. Circuit Playground Classic (http://adafru.it/3000) Express (http://adafru.it/3333) 3 x AAA Battery Holder (http://adafru.it/727) 3 x AAA Batteries (NiMH work great!) Before Starting If you are new to the Circuit Playground, you may want to first read these overview guides. Circuit Playground Classic Overview Lesson #0 Circuit Playground Express Overview Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 3 of 25

The Town Clock In the classic gunslinger show down portrayed in numerous movies, the town clock was often used as the 'go' or 'draw' signal for the two gunslingers. High noon or some other on-the-hour time was used so that the minute hand was the main 'go' indicator. As soon as it pointed straight up, it was time to draw. For our Circuit Playground Quick Draw game, we'll use the NeoPixels instead. They will initially be all off. The two players should then be at the ready. Then, after a random period of time, we will turn on all of the NeoPixels. This is the 'go' signal at which point the two players press their buttons as quick as they can. The winner is whoever pressed their button the quickest. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 4 of 25

Game Design Game Logic Once we have our random countdown time figured out, the game logic is very simple: 1. Turn off all of the NeoPixels. 2. Wait the determined countdown time. 3. If a player presses a button during this time, they drew too soon (misdraw). 4. Once countdown time has elapsed, turn on all of the NeoPixels. 5. Look for the first (quickest) button press. 6. Which ever button was pressed first is the Quick Draw winner. Player Buttons This is pretty straight forward. We've got two players, we've got two buttons. So we can assign them as shown in the figure below. Countdown NeoPixels This could be anything, but to keep it simple we'll just turn on all the NeoPixels to white when the countdown completes. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 5 of 25

DRAW! When all of the lights come on (all white), press your button as fast as you can. Player NeoPixels We can use the NeoPixels on the left to indicate Player 1's outcome, and the NeoPixels on the right to indicate Player 2's outcome. There are two possible outcomes: a misdraw if a player draws too soon, or a game with a winning outcome. PLAYER 1 MISDRAW! If all of the lights on the Player 1 side turn red, Player 1 misdrew (pressed the button too soon). Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 6 of 25

PLAYER 2 MISDRAW! If all of the lights on the Player 2 side turn red, Player 2 misdrew (pressed the button too soon). PLAYER 1 WON! If all of the lights on the Player 1 side turn green, Player 1 was the quickest. PLAYER 2 WON! If all of the lights on the Player 2 side turn green, Player 2 was the quickest. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 7 of 25

Arduino The following pages go over creating the Quick Draw game using the Arduino IDE. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 8 of 25

Randomest Random Random Isn't Random We can create the random period of time needed for the countdown using the random() function available in the Arduino library. However, it may not behave like you think it behaves. Let's take a look. Try running the simple sketch below. /////////////////////////////////////////////////////////////////////////////// // Circuit Playground Random Demo // // Author: Carter Nelson // MIT License (https://opensource.org/licenses/mit) #include <Adafruit_CircuitPlayground.h> #define SHORTEST_DELAY 1000 // milliseconds #define LONGEST_DELAY 10000 // " /////////////////////////////////////////////////////////////////////////////// void setup() { Serial.begin(9600); CircuitPlayground.begin(); /////////////////////////////////////////////////////////////////////////////// void loop() { // Wait for button press while (!CircuitPlayground.leftButton() &&!CircuitPlayground.rightButton()) { // Do nothing, just waiting for a button press... // Print a random number Serial.println(random(SHORTEST_DELAY, LONGEST_DELAY)); // Debounce delay delay(500); With this code loaded and running on the Circuit Playground, open the Serial Monitor. Tools -> Serial Monitor and then press either button. Each time, a random number from SHORTEST_DELAY to LONGEST_DELAY will be printed out. Let me guess, you got the same sequence I did as shown below. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 9 of 25

And if you reset the Circuit Playground and try this again, you will get the same sequence again. So what's going on? In turns out that the random() function implemented in the Arduino library is only a pseudo-random function. This simply means it isn't fully random (pseudo = false). It just produces a random like sequence of numbers, and the same sequence every time. To get around this, we need to initialize the random function with a random value. This is called seeding the function and the value is called the seed. But where can we come up with a random seed value? One way is to use some of the (hopefully) unconnected pads on the Circuit Playground and read in their analog values. Since the pads are not connected, the value returned by a call to analogread() will contain noise. Noise is random, and that's what we want. Here's a new version of the code that includes a call to randomseed() in the setup(). This seed is generated by reading all four of the available analog inputs. The analog pads shown are for the Circuit Playground Classic, but the code will still run on the Express. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 10 of 25

/////////////////////////////////////////////////////////////////////////////// // Circuit Playground Random Demo with Seed // // Author: Carter Nelson // MIT License (https://opensource.org/licenses/mit) #include <Adafruit_CircuitPlayground.h> #define SHORTEST_DELAY 1000 // milliseconds #define LONGEST_DELAY 10000 // " /////////////////////////////////////////////////////////////////////////////// void setup() { Serial.begin(9600); CircuitPlayground.begin(); // Seed the random function with noise int seed = 0; seed += analogread(12); seed += analogread(7); seed += analogread(9); seed += analogread(10); randomseed(seed); /////////////////////////////////////////////////////////////////////////////// void loop() { // Wait for button press while (!CircuitPlayground.leftButton() &&!CircuitPlayground.rightButton()) { // Do nothing, just waiting for a button press... // Print a random number Serial.println(random(SHORTEST_DELAY, LONGEST_DELAY)); // Debounce delay delay(500); Load this code, open the Serial Monitor, and try again by pressing the buttons. Hopefully you get a different sequence this time, and it's different than the one I got. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 11 of 25

While this isn't perfect, it will work for our needs. This is what we will use to generate the random amount of time needed for our countdown timer. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 12 of 25

The Countdown We could just use the delay() function to wait the random amount of time determined for the countdown. Something like this: // Wait a random period of time unsigned long counttime = random(shortest_delay, LONGEST_DELAY); delay(counttime); However, we need to monitor the buttons during the countdown to make sure one of the players did not cheat (misdraw). We can do this by using a while() loop instead of delay() for the countdown and polling the buttons inside the loop. That would look something like the following, note that there is now no use of delay(). // Wait a random period of time unsigned long counttime = random(shortest_delay, LONGEST_DELAY); unsigned long starttime = millis(); while (millis() - starttime < counttime) { // Check if player draws too soon. if (CircuitPlayground.leftButton()) showoutcome(1, false); if (CircuitPlayground.rightButton()) showoutcome(2, false); But what's the showoutcome() function? Well, we'll talk about that next. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 13 of 25

Show Outcome The showoutcome() function will be created to, as the name implies, show the outcome of the game. The first parameter will be the player who's button was pressed. The second parameter is a boolean to indicate if the button press was a winning press (true) or a misdraw (false). By generalizing the outcome code, to be able to show the proper NeoPixels for either player and for either outcome, we make our code more compact. Otherwise we would need to duplicate a lot of code in more than one place. It also makes it easier to change the behavior of the code in the future. The complete code for the showoutcome() function will be shown at the end. Here, we'll go through it in pieces. First, we need to declare it: void showoutcome(int player, bool winner) { We aren't going to return anything, so the return parameter is void. We take in two parameters: the player who's button was pressed as an int, and whether this was a winning game or not as a bool. Next, we create a couple of variables to be used locally within the function. int p1, p2; uint32_t color; Then we turn off all of the NeoPixels, just to insure a known state. // Turn them all off CircuitPlayground.clearPixels(); Then we set the pixel color depending on the game outcome, green for a winning game, red for a misdraw. // Set pixel color if (winner) { color = 0x00FF00; else { color = 0xFF0000; Then we set the range of NeoPixels to be lit up based on which payer pressed their button. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 14 of 25

// Set pixel range for player switch (player) { case 1: p1 = 0; p2 = 4; break; case 2: p1 = 5; p2 = 9; break; default: p1 = 0; p2 = 9; Now we have a color for the NeoPixels, and which ones to turn on, so do that. // Show which player won/lost for (int p=p1; p<=p2; p++) { CircuitPlayground.setPixelColor(p, color); And why not play a little tune. A happy one if this was a winning game, a more error sounding one if it was a misdraw. // Play a little tune if (winner) { CircuitPlayground.playTone(800, 200); CircuitPlayground.playTone(900, 200); CircuitPlayground.playTone(1400, 200); CircuitPlayground.playTone(1100, 200); else { CircuitPlayground.playTone(200, 1000); And we are done with the game, so we'll just sit here forever until the reset button is pressed to start a new game. // Sit here forever while (true) {; And don't forget the closing curly bracket to finish off the showoutcome() function. OK. Let's put it all together. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 15 of 25

Code Listing Here's the complete code listing for the Quick Draw game. /////////////////////////////////////////////////////////////////////////////// // Circuit Playground Quick Draw // // Who's faster? // // Author: Carter Nelson // MIT License (https://opensource.org/licenses/mit) #include <Adafruit_CircuitPlayground.h> #define SHORTEST_DELAY 1000 // milliseconds #define LONGEST_DELAY 10000 // " /////////////////////////////////////////////////////////////////////////////// void showoutcome(int player, bool winner) { int p1, p2; uint32_t color; // Turn them all off CircuitPlayground.clearPixels(); // Set pixel color if (winner) { color = 0x00FF00; else { color = 0xFF0000; // Set pixel range for player switch (player) { case 1: p1 = 0; p2 = 4; break; case 2: p1 = 5; p2 = 9; break; default: p1 = 0; p2 = 9; // Show which player won/lost for (int p=p1; p<=p2; p++) { CircuitPlayground.setPixelColor(p, color); // Play a little tune if (winner) { CircuitPlayground.playTone(800, 200); CircuitPlayground.playTone(900, 200); CircuitPlayground.playTone(1400, 200); CircuitPlayground.playTone(1100, 200); else { Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 16 of 25

else { CircuitPlayground.playTone(200, 1000); // Sit here forever while (true) {; /////////////////////////////////////////////////////////////////////////////// void setup() { // Initialized the Circuit Playground CircuitPlayground.begin(); // Turn off all the NeoPixels CircuitPlayground.clearPixels(); // Seed the random function with noise int seed = 0; seed += analogread(12); seed += analogread(7); seed += analogread(9); seed += analogread(10); randomseed(seed); // Wait a random period of time unsigned long counttime = random(shortest_delay, LONGEST_DELAY); unsigned long starttime = millis(); while (millis() - starttime < counttime) { // Check if player draws too soon. if (CircuitPlayground.leftButton()) showoutcome(1, false); if (CircuitPlayground.rightButton()) showoutcome(2, false); // Turn on all the NeoPixels for (int p=0; p<10; p++) { CircuitPlayground.setPixelColor(p, 0xFFFFFF); /////////////////////////////////////////////////////////////////////////////// void loop() { if (CircuitPlayground.leftButton()) showoutcome(1, true); if (CircuitPlayground.rightButton()) showoutcome(2, true); Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 17 of 25

CircuitPython The following pages go over creating the Quick Draw game in CircuitPython. CircuitPython only works on the Circuit Playground Express. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 18 of 25

The Countdown We could just use the time.sleep() function to wait the random amount of time determined for the countdown. Something like this: # Wait a random amount of time count_time = random.randrange(shortest_delay, LONGEST_DELAY+1) time.sleep(count_time) However, we need to monitor the buttons during the countdown to make sure one of the players did not cheat (misdraw). We can do this by using a while loop instead of time.sleep() for the countdown and polling the buttons inside the loop. That would look something like the following, note that there is now no use of time.sleep(). # Wait a random amount of time count_time = random.randrange(shortest_delay, LONGEST_DELAY+1) start_time = time.monotonic() while time.monotonic() - start_time < count_time: # Check if player draws too soon if cpx.button_a: show_outcome(1, False) if cpx.button_b: show_outcome(2, False) But what's the show_outcome() function? Well, we'll talk about that next. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 19 of 25

Show Outcome The show_outcome() function will be created to, as the name implies, show the outcome of the game. The first parameter will be the player who's button was pressed. The second parameter is a boolean to indicate if the button press was a winning press (true) or a misdraw (false). By generalizing the outcome code, to be able to show the proper NeoPixels for either player and for either outcome, we make our code more compact. Otherwise we would need to duplicate a lot of code in more than one place. It also makes it easier to change the behavior of the code in the future. The complete code for the show_outcome() function will be shown at the end. Here, we'll go through it in pieces. First, we need to declare it: def show_outcome(player, winner): We take in two parameters: the player who's button was pressed and whether this was a winning game or not. Then we turn off all of the NeoPixels, just to insure a known state. # Turn them all off cpx.pixels.fill(0) Then we set the pixel color depending on the game outcome, green for a winning game, red for a misdraw. # Set pixel color if winner: color = 0x00FF00 else: color = 0xFF0000 Now we have a color for the NeoPixels, so turn them on for the correct player. # Show which player won/lost for p in PLAYER_PIXELS[player]: cpx.pixels[p] = color And why not play a little tune. A happy one if this was a winning game, a more error sounding one if it was a misdraw. # Play a little tune if winner: cpx.play_tone(800, 0.2) cpx.play_tone(900, 0.2) cpx.play_tone(1400, 0.2) cpx.play_tone(1100, 0.2) else: cpx.play_tone(200, 1) And we are done with the game, so we'll just sit here forever until the reset button is pressed to start a new game. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 20 of 25

# Sit here forever while True: pass OK. Let's put it all together. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 21 of 25

Code Listing Here is the complete CircuitPython version of the Quick Draw code. # Circuit Playground Express Quick Draw # # Who's faster? # # Author: Carter Nelson # MIT License (https://opensource.org/licenses/mit) import time import random from analogio import AnalogIn import board from adafruit_circuitplayground.express import cpx SHORTEST_DELAY = 1 # seconds LONGEST_DELAY = 10 # " PLAYER_PIXELS = { 1 : (0,1,2,3,4), 2 : (5,6,7,8,9) def show_outcome(player, winner): # Turn them all off cpx.pixels.fill(0) # Set pixel color if winner: color = 0x00FF00 else: color = 0xFF0000 # Show which player won/lost for p in PLAYER_PIXELS[player]: cpx.pixels[p] = color # Play a little tune if winner: cpx.play_tone(800, 0.2) cpx.play_tone(900, 0.2) cpx.play_tone(1400, 0.2) cpx.play_tone(1100, 0.2) else: cpx.play_tone(200, 1) # Sit here forever while True: pass # Seed the random function with noise a4 = AnalogIn(board.A4) a5 = AnalogIn(board.A5) a6 = AnalogIn(board.A6) a7 = AnalogIn(board.A7) seed = a4.value seed += a5.value seed += a6.value Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 22 of 25

seed += a6.value seed += a7.value random.seed(seed) # Wait a random amount of time count_time = random.randrange(shortest_delay, LONGEST_DELAY+1) start_time = time.monotonic() while time.monotonic() - start_time < count_time: # Check if player draws too soon if cpx.button_a: show_outcome(1, False) if cpx.button_b: show_outcome(2, False) # Turn on all the NeoPixels cpx.pixels.fill(0xffffff) # Check for player draws while True: if cpx.button_a: show_outcome(1, True) if cpx.button_b: show_outcome(2, True) Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 23 of 25

Questions and Code Challenges The following are some questions related to this project along with some suggested code challenges. The idea is to provoke thought, test your understanding, and get you coding! While the sketch provided in this guide works, there is room for improvement and additional features. Have fun playing with the provided code to see what you can do with it. Questions Does it matter which order the functions leftbutton() and rightbutton() are called in? Can you think of a way to cheat the countdown timer? (hint: seed) Code Challenges Put the code that does the random seeding into a function called initrandom(). Change the color of the NeoPixels for the countdown. Come up with a different way to start a new game, instead of using reset button. Adafruit Industries https://learn.adafruit.com/circuit-playground-quick-draw Page 24 of 25