// ===================== Código em alto nível ====================
void setup(){
Serial.begin(9600);
pinMode(0, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
//pinMode(8, OUTPUT);
DDRH = (1 << PH5);
PORTH &= ~(1 << PH5);
}
void loop(){
if (!(digitalRead(0) == 1)) {
//PORTH |= (1 << PH5);
tone(8, 262, 100); // play tone 48 (C4 = 262 Hz)
delay(50);
}
if (!(digitalRead(1) == 1)) {
tone(8, 294, 100); // play tone 50 (D4 = 294 Hz)
delay(50);
}
if (!(digitalRead(2) == 1)) {
tone(8, 330, 100); // play tone 52 (E4 = 330 Hz)
delay(50);
}
if (!(digitalRead(3) == 1)) {
tone(8, 349, 100); // play tone 53 (F4 = 349 Hz)
delay(50);
}
if (!(digitalRead(4) == 1)) {
tone(8, 392, 100); // play tone 55 (G4 = 392 Hz)
delay(50);
}
if (!(digitalRead(5) == 1)) {
tone(8, 440, 100); // play tone 57 (A4 = 440 Hz)
delay(50);
}
if (!(digitalRead(6) == 1)) {
tone(8, 494, 100); // play tone 57 (A4 = 440 Hz)
delay(50);
}
}Loading
esp32-s2-devkitm-1
esp32-s2-devkitm-1