Requiring anyone to say this pledge violates the First Amendment establishment clause, which has been interpreted for a long time by the Supreme Court as applying to the states as well as Congress. It wasn't interpreted that way by the Founders, but it is currently the law of the land.
I don't know whether saying a child can get out of saying it by bringing a note from home is enough to exempt this law from being ruled unconstitutional.