Made it more user friendly with user defined variables. Also added a line
to change mode on the defined pin, in case it has not been set yet.