technoblogy/lisp-badge

playNote() not working

Closed this issue · 5 comments

Hi

and thanks for the design!

I noticed that the note function isn't working. I checked the code and found this

if (pin == 14) {
    DDRD = DDRD | 1<<DDD6; // PD6 (Arduino D14) as output
    TCCR2A = 0<<COM2A0 | 1<<COM2B0 | 2<<WGM20; // Toggle OC2B on match
  } else if (pin == 15) {
    DDRD = DDRD | 1<<DDD7; // PD7 (Arduino D15) as output
    TCCR2A = 1<<COM2A0 | 0<<COM2B0 | 2<<WGM20; // Toggle OC2A on match
  } else error(PSTR("'note' pin not supported"));

Shouldn't there be pin PB4 in there?

I tried changing it to this

  if (pin == 10) {
    DDRB = DDRB | 1<<DDB4; // PB4 (Arduino D10) as output
    TCCR2A = 1<<COM2A0 | 0<<COM2B0 | 2<<WGM20; // Toggle OC2A on match
  } else error(PSTR("'note' pin not supported"));

but it didn't work. I'm not that familiar with the registers used so that might be the problem.

The symptoms of this are, that the keyboard stops working in both cases when I either call (note 14 0 4) or (note 10 0 4). The serial communication works fine though.

Unfortunately you can't use the uLisp note function with the Lisp Badge because on the ATmega1284P note uses pins PD6 or PD7, and these are used for the keyboard on the Lisp Badge. Perhaps this could be solved in a future version of the PCB. In the meantime Version 1c allows you to play a "beep" through the speaker with (princ #\beep).

Okay, I'll write a simpler note function with tone.

Thanks for the quick response and for the badge!
P.S.
I couldn't get the beep working, I get both unknown character and incomplete list errors with that.

Sorry, I meant: (princ #\bell).

PS Glad you got the badge working; I'd love to see a photo of it!

Here's a bad photo http://i65.tinypic.com/11ioies.jpg. The screen is not blurry at all.

Great! Nice job.