We finally connected to the lego motors for this challenge. Getting everything connected correctly was a bit of a challenge because we had so many wires in the board at that point. Once we got everything connected and working we realized that we had to use the oscilloscope. So we had to get help with that... again. Finally, after we got everything set up correctly, the program that counts the shaft encoding is in the upper-left hand corner.
The other stuff is a failed and very complicated version of getting the shaft encoder to determine the direction of the motor.

We ended up with this program which counts up when the motor is turned forwards and counts down when the motor is turned backwards.
The top few programs control the motor in making it coast, brake, go forwards (thisway) and backwards (thatway).
The top few programs control the motor in making it coast, brake, go forwards (thisway) and backwards (thatway). The program below makes the motor go thisway for ten revolutions and then thatway for ten revolutions. We did this by determining the count for one revolution and then multiplying that by ten. Then we had the motor turn thisway until the count reached ten revolutions and then thatway until the count went back to zero.


No comments:
Post a Comment