This project recreates the bomb from "Keep talking and nobody explodes" (https://keeptalkinggame.com/) using two pi pico's.
The code for each module is in "./common", which can easily* be reused in other projects. Available modules:
- Timer
- Simple wires
- Complicated wires
- Button
- Keypad
Alongside the modules there is also an indicator, which flashes a red LED when a mistake is made, and illumiates a green LED when a module is defused.
To see examples of the generic code being used, see the project specific code.
* Some types of static variables will have to be changed depending on the pins used, but these are separated into type definitions in the respective module.
* Some modules rely on custom globals in common to delaying for a certain time, these can either be replaced with custom code, or make use of the "wait" module in common.
The timer module makes use of a tm1637 4 digit seven segment display to show the time remaining.
Information about this display can be found by searching "tm1637 4 digit seven segment display".
Reference Image
The wire modules do not require any specific hardware. Just wires and a resistor.
An example configuration can be found documented at the wire struct in wires.rs.
The button and keypad both require switches that have been "debounced", as there is no software support for switch debounce.
I used cherry MX switches, as i managed to get 10 switches for relatively cheap, but any switches will do.
Both the button and keypad modules require the same physical configuration
VCC -> Resistor -> Switch -> GPIO Pin
The placement of the resistor and switch can be swapped, but a resistor is needed at somepoint.
The source code for each pi is in "./pi_1" and "./pi_2".
Multiple pi's were used, as more GPIO pins were needed than available on a single pi pico. At the time of making buying another pi was cheaper than a GPIO extender, so i went with another pi. Pi 2 communicates with Pi 1 to inform Pi 1 of mistakes made and when modules are defused. Pi 1 is the "brains" of the operation, with Pi 2 reporting information to it.
Pi 1 was used to control the:
- Timer
- Buzzer
- Button Module
- Keypad Module
Pi 2 was used to control:
- 2x Simple Wires
- 1x Complicated Wires
This project was based on: https://github.com/rp-rs/rp2040-project-template (Thank you for the hard work!)
Refer to that repository for getting started and working with pi pico's in general.