Mick is your man for coding.
Not exactly sure what you want done with the lighting though?