HAHA. I found the problem. When i set all the pins low i put "portb.2" instead of "portb.0".

Everythings working now The circuit can control mains bulbs and/or LEDs with brightness control.

Im sure your all thinking "THANK GOD. Finally". I would like to thank everyone who has helped me with this. It looked really simple when i first started but if it wasnt for the people on this forum i would be hitting my head on the table right now.

Ive just got a few bits of code to add and cleanup then it should be done but im sure i can handle those myself