plan b

Le
Will plan b work if I take it right after having sex ? How long do I wait to take a pregnancy test to know for sure ?