HOW TO SET UP THE RASPBERRY PI PICO
=====================================

Do this once when your Pico arrives. Takes about 10 minutes.

WHAT YOU NEED:
--------------
- Your Raspberry Pi Pico (any version)
- Powered USB Hub (must have its own power adapter)
- The pico/ folder from this zip (already has all 4 .uf2 files + adafruit_hid)

STEP 1 — IDENTIFY YOUR BOARD:
------------------------------
Not sure which Pico you have? Run the detector tool first (see Step 6).
Or flip your Pico over and look at the chip printed on the back:

  Chip says RP2040:
    - Has WiFi antenna (small black rectangle on edge) → Pico W
    - No antenna                                       → Pico

  Chip says RP2350:
    - Has WiFi antenna (small black rectangle on edge) → Pico 2 W
    - No antenna                                       → Pico 2

NOTE: All four variants (Pico, Pico W, Pico 2, Pico 2 W) work identically
as HID controllers. The WiFi chip on the W versions is not used.

STEP 2 — FLASH CIRCUITPYTHON:
------------------------------
1. Hold the BOOTSEL button on the Pico (small white button on the board)
2. While holding it, plug the Pico into your PC via USB
3. Let go of the button
4. A drive called RPI-RP2 appears in File Explorer
5. Open the pico/ folder and drag the correct .uf2 file onto RPI-RP2:

   Pico     → raspberry_pi_pico.uf2
   Pico W   → raspberry_pi_pico_w.uf2
   Pico 2   → raspberry_pi_pico_2.uf2
   Pico 2 W → raspberry_pi_pico_2_w.uf2

6. Pico reboots automatically
7. Drive reappears as CIRCUITPY — this is where your code lives

STEP 3 — COPY ADAFRUIT LIBRARY:
---------------------------------
1. Open the pico/adafruit_hid/ folder from this zip
2. Copy the entire adafruit_hid folder into CIRCUITPY/lib/
   (create the lib folder if it doesn't exist)

STEP 4 — COPY PICO BOT FILES:
-------------------------------
1. Copy pico/boot.py to the ROOT of CIRCUITPY
2. Copy pico/code.py to the ROOT of CIRCUITPY

Your CIRCUITPY drive should look like this:
   CIRCUITPY/
     boot.py
     code.py
     lib/
       adafruit_hid/

Pico reboots automatically when you copy boot.py. That is normal.

STEP 5 — WIRE THE USB HUB:
----------------------------
   Wall socket → USB Hub (powered)
   PS4/PS5 USB → USB Hub
   Pico        → USB Hub
   PC          → USB Hub

PS4/PS5 will see the Pico as a USB controller.
PC sends commands to Pico through the same hub.

STEP 6 — FIND THE COM PORT (Pico Detector):
---------------------------------------------
Instead of hunting through Device Manager, use the included detector tool:

1. Make sure pyserial is installed:
      pip install pyserial
2. Run:
      python pico_detector.py
3. A small window opens and scans automatically
4. It shows your board type (Pico / Pico W / Pico 2 / Pico 2 W) and COM port
5. Click "Copy port" to copy the port name to your clipboard
6. Open gt7bot/config.py
7. Change: PICO_PORT = "COM3"  →  paste your port (e.g. COM5)
8. Save

If the detector shows nothing, make sure the hub is powered and the Pico is
plugged in, then click "Scan again".

You can also find the port manually:
  - Open Device Manager → Ports (COM & LPT)
  - Look for USB Serial Device (COMx)

STEP 7 — TEST IT:
------------------
1. PS4/PS5 on, GT7 running
2. Open Command Prompt or IDLE:
   python gt7bot/test_pico.py
3. Watch your PS4/PS5 — each button and axis should trigger in order
4. If everything reacts — you are done

If nothing reacts:
  - Make sure the hub is powered and all cables are plugged in
  - Replug the Pico into the hub after connecting the hub to PS4/PS5
  - Wait 5 seconds after replug before running test_pico.py again

THAT IS IT. Pico is set up. Never need to touch it again.

Website: gtras.co
