Your role in the sentence determines which pronoun is appropriate, I or me.
When forming a sentence, if you wish to speak of yourself as the person doing an action, or as a person feeling something, or having an opinion, and so on, use the pronoun I, whether you are alone or in the company of another person.
I like chocolate cake.
I went to the movies last Saturday.
I painted the house.
My friends and I all like chocolate cake.
Jane and I went to the movies last Saturday.
Sally and I painted the house.
I was startled by the sudden loud noise.
I thought the espresso was overextracted.
If you wish to speak of yourself as the person to whom or for whom something was done, or to whom something was said, etc etc, use the pronoun me for yourself, or us when you wish to speak of the group to which you belong. Use me in these situations even if you mention another person by name.
Sally baked me a chocolate cake.
Could you please help me with this heavy package?
Jane told me a secret.
The bus took us into the city.
Sally accompanied me to the embassy.
Sally told Jane and me that she was moving to Boston.
Sally gave Jane and me a kitten.
The kitten scratched me.
If you are not forming a sentence, but simply blurting out a one-word answer to a question, you can use the pronoun me:
Who wants a chocolate cupcake?