Monday, April 19, 2010

LogoChip [Challenge 7-1,2,3]

[Challenge 7-1]
To sense the rotation of our two wheels, we implemented the "shaft encoders." Because we were not sure if it was sensing the rotation, we connected it to the oscilloscope and tried to capture the motion on the wheel (it is in the video below).





[Challenge 7-2]
To keep the direction in which the wheel spins, we modified our solution code for challenge 7-1. If the wheel is spinning forward, then the sensor will detect a positive number and vice versa. The if statement that we added in the code will keep track of the count by adding or subtracting 1 to it. If the detected number from sensor 2 is positive, then it suggests that the wheel is going forward and so our count will increase by one. If is detects a negative number, then it suggests that the wheel is going backward so our count will decrease by one.



[Challenge 7-3]
Following the instruction, we have implemented the idea of H-Bridge and wired up L293D motor. To have the motor spin exactly 10 revolutions one way, stop and then back to its original position, we counted the number of counts in one revolution, which we found to be 180. Keeping record of the count, we devised the code below named "10rotate" that rotates one way and when the 'rotate' count equals 10 it rotates the other way until the count is 20.

No comments:

Post a Comment