angle sensor does not always reset when we tell it to resulting in unexpected behaviors. Let's make a more robust implementation:
1.) write function to reset the angle sensor...it should set a global variable value to the current reading of the angle sensor.
2.) write a function to "read angle sensor"...it should return the absolute value of the previous value minus the current value
3.) substitute the appropriate function everywhere in the code where we are either resetting the angle sensor or reading the angle sensor.
Note: you should store the value read into a large enough variable (perhaps a long).
Note: I recommend doing a traditional reset at the beginning of autonomous just so that we can have access to the total accumulated distance at any point in time if we so desire in the future.
angle sensor does not always reset when we tell it to resulting in unexpected behaviors. Let's make a more robust implementation:
1.) write function to reset the angle sensor...it should set a global variable value to the current reading of the angle sensor. 2.) write a function to "read angle sensor"...it should return the absolute value of the previous value minus the current value 3.) substitute the appropriate function everywhere in the code where we are either resetting the angle sensor or reading the angle sensor.
Note: you should store the value read into a large enough variable (perhaps a long). Note: I recommend doing a traditional reset at the beginning of autonomous just so that we can have access to the total accumulated distance at any point in time if we so desire in the future.