Limetime's TimeLine
반응형
article thumbnail
[Arduino] 디지털 피아노
C&C++/Arduino 2023. 1. 4. 00:48

피에조 스피커를 버튼에 따라 정해진 음이 재생되도록 설정하여 간단한 디지털 피아노를 만들어보자! #define NOTE_C4 262 #define NOTE_D4 294 #define NOTE_E4 330 int pins[] = {2,3,4}; int notes[] = {NOTE_E4, NOTE_D4, NOTE_C4}; void setup() { // put your setup code here, to run once: for(int i = 0; i < 3; i++){ pinMode(pins[i], INPUT); } } void loop() { // put your main code here, to run repeatedly: for(int i = 0; i < 3; i++){ if(digitalRead(p..

반응형