RSS Bot Posted August 3, 2016 Share Posted August 3, 2016 Ever since the first time the Wii nunchuk was hooked up to the A8 (NUNCHUK + ARDUINO = ATARI JOYSTICK) I've been wondering if it would be possible to use the analog stick readings to adjust an autofire rate to steer the car in Pole Position. The Arduino Uno, a 10kohm variable resister and a few parts was all it took to convince me that it wasn't going to work.Before the Arduino was hooked up, the Pole Position cartridge and joystick were plugged into the computer. While jogging the joystick left or right, it was observed that the controls were slow to respond, resulting in a lack of steering control. Experimentation continued with the Arduino Uno to gain some experience for future reference.The Arduino was set up with an analog reading taken by adjusting a 10K variable resistor and the output was sent to the joystick ports for left and right pins. The Arduino sketch simply takes the analog reading at a given frequency and then sets the "on" duration, proportional to the analog reading. /* * Simple test of variable autofire for right and left turn * Adjustable resistor/ no joystick * .5 second cycle adjusted on/off period */ // Variablesint resistor = 0; // Analog channelint Left_Pin = 5;int Right_Pin = 6;int steer = 0;int turnRate = 0;void setup() { pinMode(Left_Pin,OUTPUT); pinMode(Right_Pin,OUTPUT);}void loop() { steer = analogRead(resistor); if(steer < 500){ turnRate = (500-steer)/2; digitalWrite(Left_Pin,HIGH); delay(turnRate); digitalWrite(Left_Pin,LOW); delay(250-turnRate); } if(steer>524){ turnRate= (steer-524)/2; digitalWrite(Right_Pin,HIGH); delay(turnRate); digitalWrite(Right_Pin,LOW); delay(250-turnRate); }}This BASIC test program was used to verify the input. You should be able to hear the sound pulses change as the variable resister is changed.10 IF STICK(0)=15 THEN SOUND 0,0,0,020 IF STICK(0)=11 THEN SOUND 0,100,10,1030 IF STICK(0)=7 THEN SOUND 0,150,10,1040 GOTO 10The computer was booted up with Pole Position. The timing parameters in the sketch were adjusted several different times. When the on pulses were to short the computer never detected them and the same was determined when they were to long. Ever once in a while a sweet spot was found, were the steering seemed to jog at the proper rate to keep the car on the track, but never with any predictability.Never got the nunchuk hooked up for a testing. If this had been close to working a more refined way of output timeing would have been needed. The other joystick pins would need to be checked while still outputing the steering pulses. However, the idea of an adjustable auto fire circuit on any of the joystick pins may find a use in the future. Attached thumbnail(s) http://atariage.com/forums/blog/572/entry-13204-proportional-control-auto-fire-for-pole-position-steering-fail/ Link to comment Share on other sites More sharing options...
Recommended Posts