In this set up, imagine that we have two circuits. Both start and end at the Arduino. In the first, we take a wire from digital GND to the breadboard to ground the circuit. We then use the same row to connect one leg of our resistor. The second leg of the resistor should be in a separate row and connect to the short leg of the LED. The long leg of the LED should be in a different row and should have a jumper wire connecting back to digital pin 13, which will control when the light blinks. The second circuit can use the same wire from ground to the breadboard. It should then connect a wire from that grounded row to a separate row. That new row should connect to the black wire of the piezo. The red wire should be in a separate row. There should be a new jumper wire connecting the last row back to digital pin 9 to control the tones beeping. (NOTE: There is more than one correct way to build a circuit. You could separately ground each circuit.)
For input, we will use the Serial Monitor, so no electronic components are required.
For output, we will also be using an analog piezo element and a light-emitting diode (LED). When you send electricity through a piezo, it vibrates at certain frequencies which produces tones. LEDs are unidirectional: the long lead is positive, the short lead is negative.
To reduce the amount of current, we will be using one 220 ohm resistor. Resistors reduce current flow and lower voltage. The amount of resistance provided is color coded. You can always use the color chart below to determine resistance. To read more about resistors, check out https://learn.sparkfun.com/tutorials/resistors .
Comparison Operators https://www.arduino.cc/en/Reference/If