This should really be posted in "Help For New Tamagotchi Pet Owners"(and you'll find plenty of topics like this there), but anyway:
If your tama's attention light is on and the tama is crying or in a bad mood (with its back to you) - praise it.
If your tama's attention light is on and its is bouncing around as normal and doesn't need food or treats (ie hearts are all full) time out it.
This will always get you a training bar, but the second one will cause your happy heart to drop one.