Im trying to make may arduino play a sequence of notes using a buzzer.
code:
%arduino music
pin = 'D5';tune = 'eefggfedccdee dd';beats = [1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 3];notes = ['c', 'd', 'e', 'f', 'g', ' '];freq = [262 294 330 349 392 0];for ii = 1:length(tune) playTone(arduino,pin,freq(strcmp(tune(ii),notes)),0.1*beats(ii)) pause(0.1*beats(ii))end
output:
>> musicArduinoError using musicArduino (line 12)Invalid parameter type. The tone frequencyvalue must be a scalar double between 0 and32767 (Hz).
Best Answer