Circuit Playground Hot Potato

Similar documents
New Year Countdown Clock with Circuit Playground Express

Assignment #3: Piezo Cake

Arduino Lesson 3. RGB LEDs

One Shot, Two Shot, Red Shot, Blue Shot. Build Instructions

Computer Architecture and Organization. Electronic Keyboard

Make It Sound. Created by Mike Barela. Last updated on :10:45 PM UTC

Character LCDs. Created by lady ada. Last updated on :47:43 AM UTC

Introduction. The Clock Hardware. A Unique LED Clock Article by Craig A. Lindley

1. Arduino Board and Breadboard set up from Project 2 (8 LED lights) 2. Piezo Speaker

Infrared Receive and Transmit with Circuit Playground Express

Digital Circuits 4: Sequential Circuits

Module 4: Traffic Signal Design Lesson 1: Traffic Signal (Arduino) Control System Laboratory Exercise Grade 6-8

Logo Music Tools by Michael Tempel

Sample BD Tech Concepts LLC

ECSE-323 Digital System Design. Datapath/Controller Lecture #1

randomrhythm Bedienungsanleitung User Guide

Lesson 4 RGB LED. Overview. Component Required:

Shifty Manual v1.00. Shifty. Voice Allocator / Hocketing Controller / Analog Shift Register

Sample BD Tech Concepts LLC

Lab 3c Fun with your LED cube. ENGR 40M Chuan-Zheng Lee Stanford University 19 May 2017

Lecture (04) Arduino Microcontroller Programming and interfacing. By: Dr. Ahmed ElShafee

MITOCW mit-6-00-f08-lec17_300k

802DN Series A DeviceNet Limit Switch Parameter List

Repair procedures Copyright DGT Projects 2005

W0EB/W2CTX DSP Audio Filter Operating Manual V1.12

StepSequencer64 J74 Page 1. J74 StepSequencer64. A tool for creative sequence programming in Ableton Live. User Manual

Mini LED Pixel Controller Part number: PX-SPI-mini

Circuit Playground Express (& other ATSAMD21 Boards) DAC Hacks

Introduction 1. Digital inputs D6 and D7. Battery connects here (red wire to +V, black wire to 0V )

Design Example: Demo Display Unit

Microcontrollers. Outline. Class 4: Timer/Counters. March 28, Timer/Counter Introduction. Timers as a Timebase.

Laboratory Exercise 7

The BBC micro:bit: What is it designed to do?

Introduction 1. Green status LED, controlled by output signal ST. Sounder, controlled by output signal Q6. Push switch on input D6

MAutoPitch. Presets button. Left arrow button. Right arrow button. Randomize button. Save button. Panic button. Settings button

VLC-3 USER'S MANUAL. Light Program Controller. M rev. 04 K rev. 00 & ( ( 5, 352*5$0 1 : $ 2 ' 6(77,1*6 )81&7,216

Installing The PK-AM keyer and. from Jackson Harbor Press Operating: A Morse code keyer chip with pot speed control

The Basics of Reading Music by Kevin Meixner

PROFESSOR: Well, last time we talked about compound data, and there were two main points to that business.

Chapter 3: Sequential Logic Systems

Ginger Bread House

11/09/98 Martin Casemanual (version 6.21) Programming...

- CROWD REVIEW FOR - Dance Of The Drum

y POWER USER MUSIC PRODUCTION and PERFORMANCE With the MOTIF ES Mastering the Sample SLICE function

Redcare signal strength tester user manual.

MODULE 4: Building with Numbers

1 Overview. 1.1 Nominal Project Requirements

Getting Graphical PART II. Chapter 5. Chapter 6. Chapter 7. Chapter 8. Chapter 9. Beginning Graphics Page Flipping and Pixel Plotting...

SynthiaPC User's Guide

Diagnosing Intermittent MySQL Problems

XYNTHESIZR User Guide 1.5

Force & Motion 4-5: ArithMachines

INDIVIDUAL INSTRUCTIONS

User Guide: Student Account

fxbox User Manual P. 1 Fxbox User Manual

CHAPTER 16 UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL

Introduction 1. Green status LED, controlled by output signal ST

Unity is strength... when there is teamwork and collaboration, wonderful things can be achieved. ~ M. Stepanek

Edge Connector Light Level Detector

Tempo Estimation and Manipulation

OpenXLR8: How to Load Custom FPGA Blocks

Shifty Manual. Shifty. Voice Allocator Hocketing Controller Analog Shift Register Sequential/Manual Switch. Manual Revision:

USER MANUAL Nokia 5110 LCD

DIY: Synesthesia Project

ENGR 40M Project 3b: Programming the LED cube

MITOCW watch?v=vifkgfl1cn8

N3ZI Digital Dial Manual For kit with Backlit LCD Rev 4.00 Jan 2013 PCB

4830A Accelerometer simulator Instruction manual. IM4830A, Revision E1

NOTICE: This document is for use only at UNSW. No copies can be made of this document without the permission of the authors.

Arduino Nixie Clock Classic Rev4 and Rev5 All In One Modular Rev2

LDS Channel Ultra Low Dropout LED Driver FEATURES APPLICATION DESCRIPTION TYPICAL APPLICATION CIRCUIT

#029: UNDERSTAND PEOPLE WHO SPEAK ENGLISH WITH A STRONG ACCENT

127566, Россия, Москва, Алтуфьевское шоссе, дом 48, корпус 1 Телефон: +7 (499) (800) (бесплатно на территории России)

XTAL Bank DDS Version 0.02 Sept Preliminary, highly likely to contain numerous errors

Let s Animate! 15 Clock 15 Variables 17 Logic 17. I see a mistake! 20

Laboratory Exercise 7

PYTHON AND IOT: From Chips and Bits to Data Science. Jeff Fischer Data-Ken Research Sunnyvale, California, USA

Chapter 40: MIDI Tool

(Refer Slide Time: 2:03)

USER GUIDE. Get the most out of your DTC TV service!

Introduction. NAND Gate Latch. Digital Logic Design 1 FLIP-FLOP. Digital Logic Design 1

RS232 Connection. Graphic LCD Screen. Power Button. Charger Adapter Input LNB Output. MagicFINDER Digital SatLock Operating Manual

Digital TV Troubleshooting Tips

The Focus = C Major Scale/Progression/Formula: C D E F G A B - ( C )

02-Apr-07 12:34 Macintosh HD:Users:johanneparadis:Desktop:Ta...:adam32_100.cha Page 1

WASD PA Core Music Curriculum

I'm going to keep things simple. The main purpose of this tactic to show that how the story is framed makes a big difference.

The Instant Sequence

Remote Control Setup

SWITCH: Microcontroller Touch-switch Design & Test (Part 2)

Olympus BHM Microscope LED Illumination Andrew Menadue, UK

cryo user manual & license agreement

QUAD ENVELOPE MANUAL V.1

COPYING A PATTERN...35

Adalight Project Pack

C - Smoother Line Following

Variwrap Controller Manual

BooBox Flex. OPERATING MANUAL V1.1 (Feb 24, 2010) 6 Oakside Court Barrie, Ontario L4N 5V5 Tel: Fax:

Lesson Sequence: S4A (Scratch for Arduino)

Binary s UFO Inventors Manual

Transcription:

Circuit Playground Hot Potato Created by Carter Nelson Last updated on 2017-11-30 10:43:24 PM UTC

Guide Contents Guide Contents Overview Required Parts Before Starting Circuit Playground Classic Circuit Playground Express Game Play Arduino Playing a Melody Pitch Definitions Sample Melody Sketch Stopping a Melody Stop Melody 1 Stop Melody 2 Shake to Start Hot Potato Code How To Play CircuitPython Playing a Melody Pitch Definitions Sample Melody Stopping a Melody Stop Melody 1 Stop Melody 2 Shake to Start Hot Potato Code How To Play Building the Potato Eggy Eggy Battery Fit Check Eggy One Eggy Two Battery Cushion Questions and Code Challenges Questions Code Challenges 2 3 3 4 5 5 6 7 8 8 8 10 10 10 12 13 13 15 16 16 16 18 18 18 19 20 20 21 21 22 23 24 24 27 27 27 Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 2 of 27

Overview In this guide we will use our Circuit Playground to create a fun and simple game you can play with your friends. It's an old timey game called Hot Potato. Yep. People used to make games with potatoes. No soldering required! (also no potato required) Please don't use a real hot potato. That could really hurt you. Required Parts In addition to a Circuit Playground, you will need some form of battery power so you can play the game without being attached to a computer. Choose an option that works for how you plan to make your 'potato'. Circuit Playground Classic (http://adafru.it/3000) Express (http://adafru.it/3333) Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 3 of 27

3 x AAA Battery Holder with On/Off Switch and 2-Pin JST (http://adafru.it/727) (also need AAA batteries) Lithium Ion Polymer Battery - 3.7v 500mAh (http://adafru.it/1578) (or similar) If you go with the LiPo battery, be sure you have a way to charge it. 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 Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 4 of 27

Overview Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 5 of 27

Game Play The game Hot Potato has been around so long, no one is really sure where it comes from, not even the all knowing wikipedia. The origins of the hot potato game are not clear. But it does come from a time way before there was an internet and even reliable electricity. So people had to get creative. As Grandpa Simpson might say, "Back in my day all we had were taters. And we loved it!" The game is played like this: 1. Gather a bunch of friends together and stand in circle. 2. Someone starts playing a melody. 3. The 'hot potato' is then tossed from person to person (order doesn't matter). 4. At some random time, the melody stops playing. 5. Whoever is holding the 'hot potato' at that point is out. We will use our Circuit Playground to create our 'hot potato'. And since the Circuit Playground has a built in speaker, we can use it to play the melody. All we need to do is write a program to play a melody and stop it after a random period of time. Let's see how we can do this. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 6 of 27

Arduino The following pages develop the Hot Potato game using the Arduino IDE. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 7 of 27

Playing a Melody The Circuit Playground has a very simple speaker. It basically can just play one tone at a time. However, simple melodies can be created by stringing together multiple tones of different frequencies. This approach is covered here: Arduino ToneMelody Circuit Playground Sound and Music In each of these examples, two arrays are used to store the melody. The first holds the actual notes and the second specifies the duration for each note. For example, from the Arduino ToneMelody example: // notes in the melody: int melody[] = { NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 }; // note durations: 4 = quarter note, 8 = eighth note, etc.: int tempo[] = { 4, 8, 8, 4, 4, 4, 4, 4 }; To play this back, we simply loop through the array and play each note. For the Circuit Playground, that would look something like this: for (int n=0; n<numberofnotes; n++) { int noteduration = 1000 / tempo[n]; CircuitPlayground.playTone(melody[n], noteduration); delay(0.3*noteduration); } We first compute the actual note duration based on the tempo value. Then we play it. A small delay is added between each note to make them distinguishable. Pitch Definitions Note how in the melody array we used values that looked like NOTE_C4. This isn't some kind of built in Arduino magic. It is simply a variable that has been defined with the frequency value of the note C. This is discussed further in the links provided above. The key thing to remember here is that you will need to make sure to include the pitches.h file with your sketch. That is where all of these values are defined. It is nothing but a file with a bunch of lines that look like: #define NOTE_C4 262 And that's the line that defines NOTE_C4 as having a value of 262. Sample Melody Sketch Here's a sketch which plays the simple melody from the Arduino example whenever either Circuit Playground button is pressed. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 8 of 27

PlayMelody.zip https://adafru.it/voc It's a zip file which contains both the sketch along with the pitches.h file that defines the notes. So download it, unzip it, and load the sketch to the Circuit Playground. You'll know you got it working when you hear Shave and a Haircut. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 9 of 27

Stopping a Melody So now we know how to play a melody. For our Hot Potato game, we will want to let this melody play for a random amount of time and then stop it. How do we do that? There is a very simple way we can do this. Instead of thinking in terms of time, just think in terms of number of notes. We'll just pick a random number of notes and play only that many. Stop Melody 1 Here is a modified version of Mike Barela's chiptune sketch which only plays a random number of notes from the melody. StopMelody1.zip https://adafru.it/vod The modifications are minor. The majority of the new lines deal with seeding the pseudo-random number generator to increase actual randomness. It is the same approach as taken in the Circuit Playground D6 Dice guide. Here are the lines: // Seed the random function with noise int seed = 0; seed += analogread(12); seed += analogread(7); seed += analogread(9); seed += analogread(10); randomseed(seed); With that taken care, we then just compute a random number for how many notes to play and modify the loop control appropriately. int numnotestoplay = random(numnotes); for (int thisnote = 0; thisnote < numnotestoplay; thisnote++) { // play notes of the melody Try pressing the right button multiple times and hear how the length of the melody varies. Stop Melody 2 The one problem with the previous approach is it will play the melody at most only once. For our Hot Potato game, we may want the melody to play longer (multiple times) to make the game more exciting. So we want to be able to specify a random number bigger than the number of notes in the melody. Say the melody had 10 notes. A loop of 10 would play it once. But we want to be able to loop 20 times to play it twice. Or 17 times to play it once, and then the first 7 notes again. Etc. But we can't simply increase the size of our random number and use the same loop structure. Once the loop number exceeds the number of notes in the melody, bad things will happen. For example, there is no value for melody[numnotes+1]. In fact, because of zero indexing, the highest defined note is only melody[numnotes-1]. So how do we deal with this? One answer is to simply use two variables. The first will be our random loop variable that Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 10 of 27

will be the total number of notes to play. The second will be used to actually play the melody note. It will be incremented manually inside the loop, and once it exceeds the size of the melody, it will be set back to zero. That way the melody will loop. Here's a second version of the sketch that makes these changes. The two variables are setup before the loop: StopMelody2.zip https://adafru.it/vof int numnotestoplay = random(numnotes,3*numnotes); int notetoplay = 0; for (int thisnote = 0; thisnote < numnotestoplay; thisnote++) { // play notes of the melody We've increased the range of numnotestoplay (up to 3 times the length of the song). Then, the new variable notetoplay is used to actually play the note: int noteduration = 1000 / notedurations[notetoplay]; CircuitPlayground.playTone(melody[noteToPlay], noteduration); And it is incremented and checked at the end of the loop: // increment and check note counter notetoplay++; if (notetoplay >= numnotes) notetoplay = 0; Try again pressing the right button and play the melody multiple times to see how the length varies. This time however, the melody will play through at least once and then stop randomly at some point after that. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 11 of 27

Shake to Start OK, so now we can play a melody and have it stop after a random amount of time (number of notes). But how do we start the whole thing and get the game rolling? Using the buttons on the Circuit Playground would be a great way to do this. However, as you will see when we make the 'potato', the buttons may not be easily accessible. Instead, let's use the accelerometer. Then we'll just shake to start. To do this, we can just re-use the 'shake detect' method discussed in the Circuit Playground D6 Dice guide. We just need a function that returns the total acceleration value: float gettotalaccel() { // Compute total acceleration float X = 0; float Y = 0; float Z = 0; for (int i=0; i<10; i++) { X += CircuitPlayground.motionX(); Y += CircuitPlayground.motionY(); Z += CircuitPlayground.motionZ(); delay(1); } X /= 10; Y /= 10; Z /= 10; } return sqrt(x*x + Y*Y + Z*Z); Then to wait for shaking, we just check the value and do nothing until it exceeds a preset value. Yes, this is pretty boring. // Wait for shaking while (gettotalaccel() < SHAKE_THRESHOLD) { // do nothing } Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 12 of 27

Hot Potato Code OK, we are ready to put this all together into our Circuit Playground Hot Potato sketch. Here's the final result: HotPotato.zip https://adafru.it/vpa Download it, unzip, open it in the Arduino IDE, and upload it to your Circuit Playground. Note that the definition of the melody has been moved to the file melody.h. This was done mainly to clean up the main sketch. But it also makes it a little more modular, making it easier to swap out the melody for a different one. How To Play With the Hot Potato sketch loaded and running on the Circuit Playground you're ready to play. Here's how: The NeoPixels will be all red at the start (and end) of the game. SHAKE TO START! The melody will play and random NeoPixels will light up. ZOMG! START TOSSING THE HOT POTATO!!!! Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 13 of 27

When the melody stops, all the lights will turn red again. GAME OVER. (shake to play again) Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 14 of 27

CircuitPython The following pages develop the Hot Potato game using CircuitPython. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 15 of 27

Playing a Melody We will use the speaker on the Circuit Playground Express to create a melody by playing a series of simple tones. We will store the actual notes of the melody in one tuple and the length of each note in another. For example, here's a short little melody: # notes in the melody: melody = ( NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 ) # note durations: 4 = quarter note, 8 = eighth note, etc.: tempo = ( 4, 8, 8, 4, 4, 4, 4, 4 ) To play this back, we simply loop through the tuple and play each note. For the Circuit Playground, that would look something like this: for i in range(len(melody)): note_duration = 1 / tempo[i] note = melody[i] if note == 0: time.sleep(note_duration) else: cpx.play_tone(note, note_duration) We first compute the actual note duration based on the tempo value. We then check if the note is 0, which indicates a rest. If it is, we don't play anything and just sleep. Otherwise, we play the note. Pitch Definitions Note how in the melody array we used values that looked like NOTE_C4. This isn't some kind of built in CircuitPython magic. It is simply a variable that has been defined with the frequency value of the note C. This information is stored in a separate file called pitches.py which you will need to place on your Circuit Playground Express. It is included in the zip file with the rest of the code. That is where all of these values are defined. It is nothing but a file with a bunch of lines that look like: NOTE_C4 = 262 And that's the line that defines NOTE_C4 as having a value of 262. Sample Melody Here's a set of files which plays the simple melody from the example above whenever either Circuit Playground button is pressed. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 16 of 27

play_melody.zip https://adafru.it/adf It's a zip file which contains both the main program play_melody.py along with the pitches.py file that defines the notes. So download it,unzip it, and copy both files to your Circuit Playground Express. You'll know you got it working when you hear Shave and a Haircut. Be sure to change the name of play_melody.py to main.py so the program will run when you press reset. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 17 of 27

Stopping a Melody So now we know how to play a melody. For our Hot Potato game, we will want to let this melody play for a random amount of time and then stop it. How do we do that? There is a very simple way we can do this. Instead of thinking in terms of time, just think in terms of number of notes. We'll just pick a random number of notes and play only that many. Stop Melody 1 Here is a modified version of the previous program which only plays a random number of notes from the melody. It also moves the melody definition to a separate file called melody.py. Stop Melody 2 stop_melody1.zip https://adafru.it/adg The one problem with the previous approach is it will play the melody at most only once. For our Hot Potato game, we may want the melody to play longer (multiple times) to make the game more exciting. So we want to be able to specify a random number bigger than the number of notes in the melody. Say the melody had 10 notes. A loop of 10 would play it once. But we want to be able to loop 20 times to play it twice. Or 17 times to play it once, and then the first 7 notes again. Etc. But we can't simply increase the size of our random number and use the same loop structure. Once the loop number exceeds the number of notes in the melody, bad things will happen. For example, there is no value for melody[number_of_notes+1]. In fact, because of zero indexing, the highest defined note is only melody[number_of_notes- 1]. So how do we deal with this? One answer is to simply use two variables. The first will be our random loop variable that will be the total number of notes to play. The second will be used to actually play the melody note. It will be incremented manually inside the loop, and once it exceeds the size of the melody, it will be set back to zero. That way the melody will loop. Here's a second version of the sketch that makes these changes. stop_melody2.zip https://adafru.it/adh Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 18 of 27

Shake to Start OK, so now we can play a melody and have it stop after a random amount of time (number of notes). But how do we start the whole thing and get the game rolling? Using the buttons on the Circuit Playground would be a great way to do this. However, as you will see when we make the 'potato', the buttons may not be easily accessible. Instead, let's use the accelerometer. Then we'll just shake to start. To do this, we can just re-use the 'shake detect' method discussed in the Circuit Playground D6 Dice guide. We just need a function that returns the total acceleration value: def get_total_accel(): # Compute total acceleration X = 0 Y = 0 Z = 0 for count in range(10): x,y,z = cpx.acceleration X = X + x Y = Y + y Z = Z + z time.sleep(0.001) X = X / 10 Y = Y / 10 Z = Z / 10 return math.sqrt(x*x + Y*Y + Z*Z) Then to wait for shaking, we just check the value and do nothing until it exceeds a preset value. Yes, this is pretty boring. # Wait for shaking while get_total_accel() < SHAKE_THRESHOLD: pass # do nothing Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 19 of 27

Hot Potato Code OK, we are ready to put this all together into our Circuit Playground Express Hot Potato sketch. Download and unzip the following file: You should get the following 3 files: hot_potato.py - the main game melody.py - defines a melody as a series of notes pitches.py - defines tones for each note hot_potato.zip https://adafru.it/ada Place all 3 files on your Circuit Playground Express. To have the code run when you press reset, rename hot_potato.py to main.py. How To Play With the Hot Potato sketch loaded and running on the Circuit Playground you're ready to play. See the Arduino section for details. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 20 of 27

Building the Potato We got the code, now we need the potato. This doesn't need to be fancy. In fact, you can make one with not much more than a rubber band. Use a rubber band to hold the Circuit Playground to the 3 x AAA Battery Holder. Ready for action. Give it a shake and start tossing! Eggy Eggy Just so happens that this guide is being written near Easter time. This provides us the opportunity to make our potato out of a currently readily available item... Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 21 of 27

PLASTIC EASTER EGGS! I just went to the store and looked around. I ended up finding several styles of plastic Easter eggs that were big enough for the Circuit Playground to fit in. Some of these had candy in them, so I had to eat that first. The one with the clear top had a toy inside. Others were just empty. Battery Fit Check This egg style had room for a small LiPo battery. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 22 of 27

However, the 3 x AAA battery pack would not fit. :( This egg style could fit the 3 x AAA battery pack, as well as the small LiPo battery. As a bonus, it had a clear top! :) Eggy One Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 23 of 27

Here's the first egg with the Circuit Playground and the small LiPo battery installed. Ready to be closed up! Eggy Two Here's the second egg with the Circuit Playground and the 3 x AAA battery pack installed. Good to go! Battery Cushion Since the HPE (Hot Potato Egg) is going to be tossed around a lot during game play, it is a good idea to add some cushioning to the inside. You can use anything soft and stuffable, like bubble wrap. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 24 of 27

Reuse some bubble wrap from a previous shipment. Some of the Adafruit shipping envelopes are even made of bubble wrap. Get it all packed in there nice a tight (but not too tight). Close it up and you're good to go! YOU'RE READY TO PLAY. HAVE FUN! Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 25 of 27

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 sketches provided in this guide work, there is room for improvement and additional features. Have fun playing with the provided code to see what you can do with it. Or do something new and exciting! Questions What is the maximum length (in number of notes) of the game for the provided sketch? Why is a delay(2000) added to the end of the loop? (hint: read the code comment) Code Challenges Change the melody that is played during the game. Make the NeoPixels do something different during game play. Use the accelerometer to check how 'softly' players are catching the egg. If they catch it too hard, they 'break' the egg and the game is over. Adafruit Industries https://learn.adafruit.com/circuit-playground-hot-potato Page 26 of 27