How long does it take for birth control to take effect?

Victoria
I recently was prescribed birth control. I was told to take it when I got my period. On the 1st/2nd day of my period, I took my pill for the first time at precisely 7:00am. I was told to take it everyday at the same exact time. I read online that the pill become effective immediately when taken within the first 5 days of a period. However, there are other sites that said the pill does not take effect until after a week of taking it-despite whether or not you've started on your period. I had unprotected sex the first day of ever taking my pill because I thought I'd be protected. Then later after the unprotected sex, I found that article stating that I wasn't protected. So now I'm confused. Am I at risk for pregnancy? Did the the pill take effect immediately that first day in the morning since I was on my period?