'doorlock' does not name a type

It's not a program, just a few odd lines of code. Specifically you have no setup(), no loop(), no includes, no definition of doorlock and no Serial.begin().

Come back when you've fixed those and we'll try again.

Steve