added electronics page

ohsqueezy 2023-05-16 15:25:27 -04:00
parent e250c12d8f
commit 8e49ff6caa
2 changed files with 36 additions and 11 deletions

31
Electronics.md Normal file

@ -0,0 +1,31 @@
Electronics
===========
![Finished breadboard](../../raw/branch/main/doc/img/circuit_finished_breadboard.jpg)
The platform needs to be connected to a simple Arduino circuit in order to send input to the game. This document explains how to create the circuit shown above and load the necessary program onto it. The above image shows a Raspberry Pi in place of the Arduino, but the circuit is identical.
Circuit
-------
Four input pins on the Arduino need to be connected to the game's four input pads, with a 4.7k resistor in each connection.
1. Add the screw terminals the breadboard, making sure there are four terminals total, with each pin in its own row on the breadboard. In the image above, two components are used, each containing two terminals.
2. Connect a 4.7k ohm resistor to each terminal pin by placing it in the same row as the terminal.
3. Finally, connect Arduino pins 2, 3, 4, and 5 to the breadboard using jumper wires, one to each row that ends in a screw terminal (refer to the colored wires in the image above).
Loading the program
-------------------
![Arduino IDE upload](../../raw/branch/main/doc/img/arduino_IDE_upload.png)
Download the [Arduino IDE](https://www.arduino.cc/en/software) and connect it to the Arduino. Make sure the Arduino is connected in `Tools -> Port`. Open the file [serial/serial.ino](../../raw/branch/main/serial/serial.ino) from the Scrapeboard code repository into the IDE. Load the program into the Arduino using `Sketch -> Upload`.
Testing the circuit
-------------------
Launch the game without any flags to indicate Arduino mode. Serial data being output by the Arduino will be read over USB.
./OPEN-GAME
Each terminal corresponds to one of the four metal plates on the platform. Input is sent to the game by connecting any two metal plates using another piece of metal as a conductor, for example, the metal on the underside of the board. For now, use a jumper wire to test the connections between terminals. Insert one end of the wire into any terminal, and the other end into any other terminal. The lizard should appear on screen.

@ -3,14 +3,6 @@ Software
The game currently needs to be installed from the source code, though we plan to have pre-built executables available in the future. It can be played on any operating system as long as Python and Pygame are installed.
Requirements
------------
* [Python 3.7+](https://python.org)
* [Pygame 2+](https://pygame.org)
* [Git](https://git-scm.com/)
* [Scrapeboard + PGFW code repository](https://open.shampoo.ooo/scrape/scrapeboard)
Python
------
@ -57,16 +49,18 @@ Install pygame through pip
sudo pip install pygame
### Scrapeboard and PGFW
Scrapeboard
-----------
Use Git clone with the `--recursive` flag to download both Scrapeboard and the Pygame framework it uses from the command line (or PowerShell on Windows and Terminal on OS X). This can also be done from a Git GUI.
git clone --recursive https://open.shampoo.ooo/scrape/scrapeboard
cd scrapeboard/
### Launch
Launch
------
![Launch from command line](../../raw/branch/main/img/launch_from_command_line.png)
![Launch from command line](../../raw/branch/main/doc/img/launch_from_command_line.png)
It should be possible to run in keyboard mode and test input with key presses now. The `--no-serial` flag indicates to use keyboard mode because there is no Arduino attached.