Problem with code

if(b=1)

Very unlikely this is what you meant to do.

And what do you mean by "turn off"?

If the board is shutting down, it is likely you have a short circuit somewhere causing the on board poly fuse to activate. Are you sure it is "turning off"?