Monday, October 25, 2010

error: 'PB4' was not declared in this scope



I saw this error when compiling the Music Shield code for ATMega328. The cause was that ATMega328 uses the following format for port names:

PORT + "letter" + "number" (ie. PORTB4)

instead of

P + "letter" + "number" (ie. PB4)

So all you have to do is to replace every occurrence of P[ABCD][1234] with PORT[ABCD][1234]

1 comment:

  1. Hi there Jader,

    Unfortunately some Arduino libraries are very platform-dependent, so every now and then you may have a hard time porting it from a microcontroller flavor to another one.

    Marcelo

    ReplyDelete