Code problems with transistor

Yeah, I see that now. Thought it was all going to be done in integer math. My bad.

Can you post a schematic of your setup.