Here are some of the issues I ran into when following Bran Fokke’s tutorial and how I overcame them.
Problem 1: The “click event procedureâ€
As it turns out, I had not correctly written the click event procedure for the button I added to my form. Initially, I had nested two click event procedures within each other. Additionally, I had named my button something different than what Fokke had named his in his tutorial. As such, I started debugging my program. After some time, I was able to figure out how to add a click event procedure to a button in a form using C#. Again I ran the program. This time there was no errors when I executed it. Everything seemed to be perfect. Then I tried to click the button, expecting the robot to turn, on my form and nothing happened. This was a little frustrating for me because I did not know where to go to next.
Problem 2: The “AutoPoll propertyâ€
I started trying to find the error in my program by rereading Fokke’s tutorial. However, it appeared I had followed it correctly. In attempt to fix my problem, I decided to make sure each motor was assigned to the right port on the NXT brick and that I had chosen the correct COM port. Everything was set up right. I then looked at the program Fokke provided in the QuickStart.zip, which can be found in the download section on Fokke’s website, for inspiration. What I found out is that in his NXTBrick component he had set the AutoPoll property to true. So I went back to my program and set it to true also. To my excitement, I was able to click on the button in my form and the robot turned clockwise. Wow! Awesome! Great! Spectacular!