Thomas's magic edit

He added a magic constant and I think not much else. Seems to work
OKish.  All the LED output control stuff is added.