Using the game paddle in the laboratory and classroom. John F. De Gilio.
Many teachers think the hand controllers (game paddles) that attach to the microcomputer are frivolous nd don't belong in the laboratory or classroom. The association of controlers with game playing has given them a bad reputation, but sometimes entering data through the game paddles is better than using the keyboard.
I offer a rationale and a method for using the hand controllers in the design of software for student use. For illustrative purposes, I use the Apple computer code, but the logic is easily converted to other computer systems.
When a teacher brings a microcomputer to the class or laboratory as a "number cruncher" to process student data, he can expect the longest queue to be students awaiting their turn to enter data on the keyboard. This nonproductive time results from students' inexperience with a keyboard and the need to press the return as well as the inability of the computer to process more than one student's data at a time. The game paddles reduce data entry time because they rely only on the student's ability to turn a knob and press a button. For very young or unskilled students and large classes, to approach two paddles on a stand is less threatening than to face an entire keyboard. The teacher spends less pre-lab time explaining how to use the computer. In addition, by down playing the role of the computer, the focus remains on the laboratory exercise. Setting Up
You will need a laboratory stand with a sturdy rectangular base and a short upright bar to which the hand controllers may be attached with clamps, rubber bands, or masking tape. The monitor, facing away from the keyboard, is placed on the computer and beside the paddle stands. Students, with the data that they have collected or derived, approach the paddles and turn the knobs on the controllers while watching the screen. The numbers change on the screen until they match the student's data. In this way, the student can input two variables. When the screen matches the student data, the student presses the button on the side of the controller, and the computer proceses the data and flashes the information on the screen. The other paddle button resets the screen for the next student, and the process begins again.
For this type of application you must create an initialization module that enables the teacher to set parameters and a use module for the student. Before the class, the teacher loads the program, sets the maximum values to be displayed by each paddle, the precision, and the units and format for displayed values. Once the parameters are set, the teacher switches to the use mode for students. Programming
The Basic computer language has built in a facility to read the value of the knob settings and determine whether the button on the side has been pressed. In Applesoft Basic, you can do this with the following programming lines: 95 Home 100 X=PDL (0):REM READ PADDLE ZERO 120 VTAB 10:PRINT "PADDLE ZERO SETTING = ":X 140 Y=PDL (1):REM READ PADDLE ONE 150 VTAB 12:PRINT "PADDLE ONE SETTING = ":Y 200 GOTO 100
The game controllers are numbered 0 and 1 and should be clearly marked to distinguish them. The values generated by both paddles are between 0 and 255, depending on the amount of rotation. Because partial rotation is a fraction of a complete turn, it can be expressed as the decimal equivalent of the full rotation. Inclusion of the following code lines makes that adjustemnt:
These code lines generate values of X and Y that range between 0 and 1. The following lines allow for setting the maximum values to be generated by each paddle:
With the inclusion of the statements above, the values generated by the paddles will range between zero and the set maximum. Then you must round them to the appropriate decimal place, which is determined by the accuracy of the measuring instruments that the students use. It is important to set the number of decimal places under program control. To do this, add the following statements:
Now the values are right, but because of printing problems you must format the data and print them properly.
Change the print statements for character data.
When the program is run, the paddle values are in a clear, readable form at the precision dictated by the teacher. Then include those lines for which the function is intended. With the values collected by the students, incorporate the algorithm that processes the values. In the illustration you multiply the values input through the paddles. Any Basic arithmetic statement could be substituted. It could be as easy as addition or multiplication, but it also could include any algorithm that requires two variables to solve for an unknown. To ensure that the computer is working with the values that are being displayed to the student, turn the character values (X$ and Y$) to numeric form. In the illustration I do not format the result and leave it to readers who want to use the function in this form: Ending The Function
The last problem is to end the function in a normal fashion. You have the opportunity to use the button on the side of the paddles. Usually when the paddle button is not being pushed, a random number is being stored in a particular location in the machine. As soon as the button is pushed, that random value jumps to a number greater than 127. The program can tell the button has been pushed by checking the core location and testing the number that has been stored there. Each paddle button has its own location. For paddle 0 button you can test for a pushed button by PEEK(- 16287). To test paddle 1 use PEEK(- 16286). In Listing 1 you use the paddle 1 button to end the function. That is, when the value returned by the PEEK is less than 127, you read the paddles; when it is higher than 127, you end the program. Listing 2 is a more elegant form of this function.
You can adjust the algorithm for calculations to do many tasks in the laboratory or classroom. For example, the algorithm can be used to input voltage and amperage to calculate the resistance in an Ohms law lab. With a little programming finesse, it can use all four paddle inputs to calculate multiple resistors in series and in parallel circuits. Wattage, density, frequency, wavelength, vector analysis, radioactive decay, percentage composition, pH, calorimetry, and electrochemistry problems may be solved this way. A Range Finder
Other applications use the paddle directly to measure for problem solving. Students learn how specialized computers are used to solve problems. To illustrate this method, let's look at how the paddles are used to create a "range finder." This device, which cuts across a wide spectrum of curricula, could be part of a study of geology, astronomy, physics, or physical science. The object of a range finder is to determine the distance to an object measured by indirect means.
The principle of a range finder is based on trigonometric functions known to every student of elementary algebra. The concept is that "the product of the tangent of the base angle of a right triangle and the base length determines its altitude" (Figure 1).
You need only an angle measuring device and a measured base line. A computer range finder can be constructed by taping a game paddle over the end of a meter stick, ensuring the center of the turning knob is over the one-meter mark (Figure 2). To the other end of the meter stick, fix a T cut from sturdy cardboard. The downstroke of the "T" is carefully taped to the side of the meter stick away from the paddle. Place three sighting pins in the horizontal bar of the T, so they can be used as sights. The middle pin is used to verify the alignment of the paddle to ensure a right angle.
Cut a circular dial from stiff cardboard and mark it with 0 to 180 degrees counter-clockwise (Figure 3). In the center of the circular card cut a hole that will fit snugly over the paddle knob. Place a sighting pin in the 0 and 180 degree mark. The accuracy of the sighting circle is dependent, in part, on the diameter.
The calibration module must allow for the input of the base length.
Check the orientation of the dial sights; reset the card on the knob, so when the angle is measured visually it agrees with the angle projected on the screen. Once the calibration is complete, the measuring module projects the continuous distance from the angle between the base and 90 degrees.
The student sights the target whose distance is to be determined with the T end of the base line. His partner sights along the pins on the dial card to the target, and the screen shows the distance to the target.
The program (Listing 3) is designed in four segments: the menu, the instructions to construct the device, the calibration module, and the use module.
You may want to improve the basic design. For example, the sighting pins can be replaced with a mirror, beam splitter, and laser for a more accurate and dramatic demonstration. With some rebuilding, the function could be adapted for both paddles and would use the Law of Sines, eliminating the need for the right triangle. Measuring Acceleration
Another laboratory use for the game paddles is a reasonably accurate timer to determine the velocity and acceleration of moving bodies. If paddle 0 is attached between the rails of an inclined plane and paddle 1 is attached a measured distance down slope, a ball can be used to turn the timer on and off. The program can be modified to measure the acceleration directly. The program below could be used as a timer. Of course, you may want to adjust the delay loop in line 90 for your system. Joystick Pendulum
A favorite laboratory apparatus uses the joystick as a pendulum. In this case the device is turned upside-down and placed in a long-armed ring stand. A sturdy mass is attached to the handle and it is allowed to swing freely. Inventive students will want to reduce the influence of friction by modifying the joystick and within limits this should be encouraged. Because Basic is generally not fast enough to do the plotting, the program shown in Listing 4 uses a shape table to do the tracing. Summary
I have suggested a few of the uses for paddles in the laboratory and classroom, and invite readers to refine and extend the concept. I have found that students who are equipped with beginning programming skills and an interest in engineering can design ways to use the paddles in other useful measuring instruments such as tone generators, sine wave generators, interferometers, and so forth. Using the computer in the classroom to solve this type of problem helps students to understand the meaning of the "computer revolution."