Random Note Piano Key

Unleash a random stream of notes when you press down one button on the piano.

Code

The code in the editor below already works. Just plug in your Code Piano and press upload to see what it does! Tinker with it and make changes to see what each line of code controls.

Walkthrough Videos

Watch the videos for line-by-line explanation of how the example program works. Then you'll be ready to make some changes of your own!

Challenges

Can you complete the challenge? Change the code in your code editor above. Upload your code to see the effect when you're finished. Complete a challenge? Check it off the list!


Concepts

These are the new code concepts covered in this example program. To become a great coder, read through these concepts to learn new vocabulary.

New Concept: Combining concepts

As you learn more and more about code, you’ll find new ways to use concepts you’re already familiar with. In this case, you’ve already used the ‘random’ function, but now you have the power of ‘if’ statements to combine it with!

A curious coder is a good coder, so think about ways that you can integrate your latest skills with some of the concepts you’re already familiar with. You will be surprised how many fun combinations you can create!

Quiz

If you're having trouble, try to run an experimental program or look at the example code to help you find the answer.

1. What are the two arguments that the random function requires?