We have decided to go with a controller that plays the classic doom game. In the spirit of running doom on anything. Anything less than a creative controller would be not in spirit of doom. Thematically we have decided to go with a skull to fall in align with the graphic nature of the game. We also chose doom due to it being locked on the X and Y axis for aiming. Using a gyroscope for moving and clicking the jaw for shooting and a slider for weapon select. We feel this is the perfect way to really make doom come to life.
Sketch:
Schematic:
Code:
SET THRESHOLD_ACCEL = numberSET THRESHOLD_SOUND = numberSET lastSliderSlot = 0LOOP:READ X and Y from accelerometer// Up/Down (Y Axis)IF Y > THRESHOLD_ACCEL:SEND "Up" arrow key downELSE:SEND "Up" arrow key releaseIF Y < -THRESHOLD_ACCEL:SEND "Down" arrow key downELSE:SEND "Down" arrow key release// Left/Right (X Axis)IF X > THRESHOLD_ACCEL:SEND "Right" arrow key downELSE:SEND "Right" arrow key releaseIF X < -THRESHOLD_ACCEL:SEND "Left" arrow key downELSE:SEND "Left" arrow key releaseREAD sound_level from sound sensorIF sound_level > THRESHOLD_SOUND:SEND "Space" key downELSE:SEND "Space" key releaseREAD sliderValue from pin as slotIF slot != lastSliderSlot:// Only send the key press if the slot changedSWITCH slot:CASE 1: SEND "1" key press, then releaseCASE 2: SEND "2" key press, then releaseCASE 3: SEND "3" key press, then releaseCASE 4: SEND "4" key press, then releaseCASE 5: SEND "5" key press, then releaseCASE 6: SEND "6" key press, then releaseCASE 7: SEND "7" key press, then releaseCASE 8: SEND "8" key press, then releaseEND SWITCHlastSliderSlot = slotREAD Jaw value from pinIF circuitPinValue == HIGH:SEND "Ctrl" key downELSE:SEND "Ctrl" key release
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.