light control unit code problems

You can't nest function declarations