Passato prossimo indicates a specific past action that has completed once.
Ieri sera ho mangiato una pizza alle 23:00.
(Last night I ate a pizza at 11:00pm.)
This action is now completed.
Imperfetto describes a past action that was ongoing and habitual.
This is introduced by:
Ogni anno andavo al mare
(Every year I went to the shore.)
Di solito, prendevo un caffe' al bar.
(Usually, I got a coffee at the bar)
Spesso leggevo per 2 due ore.
(Often, I read for 2 hours)
(The above past action that was ongoing)