first commit

This commit is contained in:
RezHackXYZ 2025-07-09 06:36:44 -07:00
parent 07e8988160
commit 5ca37d5ffd
No known key found for this signature in database
GPG key ID: C4C90E569C9669E2
5 changed files with 563 additions and 0 deletions

BIN
BOM.csv Normal file

Binary file not shown.
1 ID Name Designator Footprint Quantity Manufacturer Part Manufacturer Supplier Supplier Part Price Pins 3DModel Contributor JLCPCB Part Class link
2 1 HS13L03W2C01 OLED1 OLED-TH_L35.4-W33.5_HS13L03W2C01 1 HS13L03W2C01 HS(汉昇) LCSC C7465997 5.076 4 OLED-TH_L35.4-W33.5_HS13L03W2C01 lcsc Extended Part https://atta.szlcsc.com/upload/public/pdf/source/20230720/8731A47396DED074CDCD72E9ACEFB46F.pdf
3 2 1TS005F-2500-5001 SW1,SW2 SW-SMD_4P-L6.0-W6.0-P4.50-LS9.0-H2.5 2 1TS005F-2500-5001 HYP(鸿源精密) LCSC C255812 0.031 4 LCSC Extended Part https://atta.szlcsc.com/upload/public/pdf/source/20180720/C255812_0808C7D708FD1FB7246546D29134BBAD.pdf
4 3 RP2040-ZERO U2 COMM-SMD_RP2040-ZERO 1 RP2040-Zero Waveshare(微雪电子) LCSC C5350143 5.162 33 lcsc Extended Part https://www.waveshare.net/wiki/%E6%96%87%E4%BB%B6:RP2040-Zero-3.jpg

29
JOURNAL.md Normal file
View file

@ -0,0 +1,29 @@
# JOURNAL
Total time spend: 1.2 hour
## 9 Jul
### circuit diagram
**time spend:** 15 min
**what i did:** some simple logic in my brain told me that i need 2 buttons, a display and a chip so i placed them and wired them in the schematic!
**images:** ![my circuit diagram](https://hc-cdn.hel1.your-objectstorage.com/s/v3/5bddc22bf6116f6ae2bc093ed7d6ff0133d386d8_image.png)
### routing pcb
**time spend:** 25 min
**what i did:** i first tryed to do it all in just the top layer! and i successed, but then i tryed auto rouuter and it did it so mutch better!
![pcb](https://hc-cdn.hel1.your-objectstorage.com/s/v3/c7f5ffc6a84ae95af3f872ddfb5ebe8823c38076_image.png)
### wrote the code for this to work!
**time spend:** 40 min
**what i did:** used 2 simple tempelate codes for using the display and the button then merged them and added some of my own logic cosue i know python! tho i have no idea on how to test it :(
### done

368
PCB.json Normal file

File diff suppressed because one or more lines are too long

57
SCHEMATIC.json Normal file

File diff suppressed because one or more lines are too long

109
firmware or whatever! Normal file
View file

@ -0,0 +1,109 @@
import board
import busio
import digitalio
import adafruit_ssd1306
import time
i2c = busio.I2C(board.GP1, board.GP0)
oled = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
oled.fill(0)
oled.show()
switch1 = digitalio.DigitalInOut(board.GP14)
switch1.direction = digitalio.Direction.INPUT
switch1.pull = digitalio.Pull.UP
switch2 = digitalio.DigitalInOut(board.GP13)
switch2.direction = digitalio.Direction.INPUT
switch2.pull = digitalio.Pull.UP
player1_time = 300.0
player2_time = 300.0
current_turn = 0
last_update_time = 0.0
game_over = False
last_sw1_state = True
last_sw2_state = True
debounce_delay = 0.2
last_press_time = 0.0
oled.text("PRESS ANY BUTTON", 0, 12, 1)
oled.show()
while True:
current_monotonic_time = time.monotonic()
if not game_over:
if current_turn == 1:
elapsed = current_monotonic_time - last_update_time
player1_time -= elapsed
last_update_time = current_monotonic_time
if player1_time <= 0:
player1_time = 0.0
game_over = True
current_turn = 0
elif current_turn == 2:
elapsed = current_monotonic_time - last_update_time
player2_time -= elapsed
last_update_time = current_monotonic_time
if player2_time <= 0:
player2_time = 0.0
game_over = True
current_turn = 0
sw1_current_state = switch1.value
sw2_current_state = switch2.value
if (
not sw1_current_state
and last_sw1_state
and (current_monotonic_time - last_press_time) > debounce_delay
):
if not game_over:
if current_turn == 1:
current_turn = 2
last_update_time = current_monotonic_time
elif current_turn == 0:
current_turn = 2
last_update_time = current_monotonic_time
last_press_time = current_monotonic_time
if (
not sw2_current_state
and last_sw2_state
and (current_monotonic_time - last_press_time) > debounce_delay
):
if not game_over:
if current_turn == 2:
current_turn = 1
last_update_time = current_monotonic_time
elif current_turn == 0:
current_turn = 1
last_update_time = current_monotonic_time
last_press_time = current_monotonic_time
last_sw1_state = sw1_current_state
last_sw2_state = sw2_current_state
oled.fill(0)
p1_minutes = int(player1_time // 60)
p1_seconds = int(player1_time % 60)
p1_display = "{:02d}:{:02d}".format(p1_minutes, p1_seconds)
p2_minutes = int(player2_time // 60)
p2_seconds = int(player2_time % 60)
p2_display = "{:02d}:{:02d}".format(p2_minutes, p2_seconds)
oled.text("P1: {}".format(p1_display), 0, 0, 1)
oled.text("P2: {}".format(p2_display), 0, 16, 1)
if game_over:
if player1_time <= 0:
oled.text("P2 WINS!", 70, 0, 1)
elif player2_time <= 0:
oled.text("P1 WINS!", 70, 16, 1)
oled.show()