Turning and Textboxes

Having the user select the amount of degrees to turn proved to be quite a challenging process. To control the degrees the robot turns, I thought it would be best to use a textbox in which the user typed in the degrees. In Fokke’s tutorial, he provided a command to turn the robot. However, when you type in the amount of degrees, for example 90 degrees, the robot does not turn that amount. Instead, the motor turns 90 degrees but the robot does not due to slipping. To overcome this issue, I had to determine the amount of degrees a motor must spin in order to turn the robot the correct amount of degrees. After much trial and error, I found that the amount of degrees the user types into the textbox has to be multiplied by about four. In addition, for each 90 degree interval, the amount of degrees the user types in the textbox has to not only be multiplied by four, but an additional amount of degrees has to be added to the number. Because of this, I had to create an if/then statement for each 90 degree interval, up to 360 degrees. During the process of figuring out how to get the robot to turn, I learned how to write an if/then statement, declare a global variable, and convert a string in to a number in C#.

Leave a Comment