Completed python code to allow python full control over the sensor position