Tuesday, April 6, 2010

challenge #8- 8.3

For this challenge, Esther and I used shaft encoders to program our MotorCar to go forward until "counta" is 1000 and then go backward until "counta" is 0.

We first copied a code on the course website into the Procedures Window as text-language on PicoBlocks. This code created new blocks that allowed us to count in a separate thread and to watch the shaft encoders that control the two motors.

Like in Challenge #6, we went about making this program in two parts. We created two separate threads: one that tells the motor to go forward for a certain count and the other tells the motor to go backward for a certain count. We set that once counta was higher than 1000 (in the first part) or once counta was lower than 0 (for the second part), the motors would stop.
This is a picture of these two threads:

We then combined these two threads to create our program. We added a wait block because quickly reversing the motors can generate power spikes that cause the LogoChip to crash.
This is a picture of our program:
Here is a video of our program:

No comments:

Post a Comment