Hallo allerseits,
ich versuche derzeit dem Arduino Sound zu entlocken, baue sozusagen einen kleinen Synthesizer. Hab nun aber folgendes Problem..
Ich will es so bauen das wenn man verschiedene Buttons drückt Sound rauskommt. Ich frage also den Buttonstatus ab und dann kommt Ton.
Das funktioniert bis zu Sieben Buttons, nach dem Siebten kommt kein Ton mehr heraus. Hat jemand eine Idee woran das liegen könnte und was man tun kann.
Danke im vorraus.
Hier übrigens der Quellcode
int buttonPin[9] = {2,3,4,5,6,7,8,9,10,};
int buttonState[9];
int audioPin = 9;
void writeAudio(uint8_t val)
{
OCR1A = (val);
}
uint16_t phase=0;
uint16_t speed=200;
uint8_t sample=0;
SIGNAL(TIMER1_OVF_vect){
writeAudio(sample);
phase += speed;
if(phase>=32768)
sample=255;
else
sample=0;
}
void setup() {
for(int i=0; i<49;i++)
{
pinMode(buttonPin[i], INPUT); // Set the switch pin as input
}
pinMode(audioPin, OUTPUT);
TCCR1A = _BV(WGM10) | _BV(COM1A1);
TCCR1B = _BV(CS10) | _BV(WGM12);
TIMSK1 |= _BV(TOIE1);
}
//der wichtige Part :-)
void loop(){
for(int j=0; j<9;j++)
{
speed=digitalRead(buttonPin[j])*55;
delay(100);
}
}