fixed wrong ranges
fixed problem with set value, setting pin dir is now at the right place,
exit raises now a now a non 0 return value
added return value to exit functions