7. Code Explanation
doremi[]{ . . . }; Linear array is used to store data, which generally are considered as a series of variables of the same
type. Analogically, data are neatly put in ordered boxes, so that we can take the sequenced numbers to use corresponding
data.
tone(pin, frequency) "pin" is the arduino pin generating tones in a total of 6 pins. "frequency" is the note frequency
in the unit of Hz.
unsigned int is the data type within range of 0 ~ 65, 535 ((2^16) - 1).
1. "tone" function controls the module to generate square waves in certain frequency(duty cycle of 50). It sings
until "noTone()"(Stop to sing) is activated.
2. Tones can be emitted by connecting the pin to a piezoelectric buzzer or other speakers.
3. For each time, tone() generates only one type of tone. Thus, if a tone is played on some pins, this function will
be invalid.
4. tone()function disturbs the PWM output on pin 3 and pin 11 (on any board excluding Mega).
5. The sound frequency generated by tone() must be more than 31Hz. So when you play tones in different frequency
on numerous pins, noTone() is necessary on one pin and followed by tone() on next pin.
noTone(beeppin); It stops the tone generation(stops singing). You can directly add the pin number.
8.5.10 Project 9Digital Tube Display
1. Description
This 4-Digit tube display is a device used to display counting or time, which is able to display numbers from 0 ~ 9 and
simple letters. It consists of four digital tubes, each of which has seven light-emitting diodes (LED).
Moreover, multiple functions can be realized by connecting their pins to the Arduino development board, such as
timekeeping and some game storing.
8.5. Arduino Project
ESP32 Starter Kit
69
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers