Autorul poate fi contactat la adresa: Login pentru adresa
Activez butoanele:
DDRA &= ~1);
PORTA |= (1«PC6) | (1«PC7) | (1«PA2) | (1«PA3) | (1«PA4) | (1«PA5) | (1«PA6) | (1«PA7);
TCCR1B |= (1 << CS10) | (1 << WGM13) | (1 << WGM12); TCCR1A |= (1 << WGM11) | (1 << COM1B1) | (1 << COM1A1);
ICR1 = 60000; OCR1B = ICR1 / 4; OCR1A = ICR1 / 2;
Daca un buton este apasat :
if(!(PINC & (1<<PC6))){
do_magic(0);
}
unde
void do_magic(int nota){
if (current_duration < 0){
var = (var + 1) % 66;
ICR1 = 16000000UL / notes_vec[fun] - 1;
OCR1A = ICR1 / 2;
DDRB |= _BV(PB3);
PORTB |= _BV(PB3);
if(modul == 1){
music_rec[nrNotes++] = notes_vec[nota];
}
}
else current_duration-= 8;
}
}
A fost un proiect interesant, pacat ca nu am reusit sa il termin.
Partea hardware a fost usor de realizat, dar nu pot spune acelasi lucru despre partea software
.