Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/guides/user/arduino-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ sends every configured *exit* token once, as a "turn everything off" sweep.

## Prerequisites

- A **live** project created with **"Usar Arduino"** enabled in the wizard
- A **live** project created with **"Use Arduino for synchronization"** enabled in the wizard
(live configuration step), with the correct serial **port** selected.
- The Arduino connected and flashed with your sketch.
- At least one **ROI** defined in the **"Configuração de Zonas"** tab.
- At least one **ROI** defined in the **"Zone Configuration"** tab.

The serial port (and baud rate) is a per-machine setting in
[`config.local.yaml`](../../../config.local.yaml):
Expand All @@ -39,14 +39,14 @@ command.

## Configure bindings

1. Open the project and go to the **"Configuração de Zonas"** tab.
1. Open the project and go to the **"Zone Configuration"** tab.
2. Define your ROIs as usual.
3. In the **"Comandos Arduino por Zona"** panel (bottom of the left column):
3. In the **"Per-Zone Arduino Commands (Optional)"** panel (bottom of the left column):
- Click **🔄 ROIs** to load the ROI names you just defined.
- Pick a ROI from the **ROI** dropdown.
- Type the integer to send in **Entrar** (on enter) and/or **Sair** (on exit).
- Click **Adicionar / Atualizar**. The row appears in the table and is saved.
4. Repeat for each ROI. Use **Remover** / **Limpar** to edit the table.
- Type the integer to send in **Enter** (on enter) and/or **Exit** (on exit).
- Click **Add / Update**. The row appears in the table and is saved.
4. Repeat for each ROI. Use **Remove** / **Clear** to edit the table.

You only ever *type* the short integer token — everything else is a selection.

Expand All @@ -62,7 +62,7 @@ The bundled `Program_Final.ino` maps integers to LED on/off pairs:
| `7` | Red LED 2 ON | `8` | Red LED 2 OFF |

To light Red LED 1 while a fish is in the ROI named `Direita`, set that ROI's
binding to **Entrar = 1**, **Sair = 2**. The LED turns on when the fish enters,
binding to **Enter = 1**, **Exit = 2**. The LED turns on when the fish enters,
stays on while it remains, and turns off when it leaves — and the end-of-session
sweep guarantees it is off after recording stops.

Expand All @@ -81,8 +81,8 @@ sweep guarantees it is off after recording stops.

## Troubleshooting

- **Panel not visible** — the project is not live, or **"Usar Arduino"** was not
enabled at creation. A note in the panel explains this.
- **Panel not visible** — the project is not live, or **"Use Arduino for
synchronization"** was not enabled at creation. A note in the panel explains this.
- **ROI dropdown empty** — define ROIs first, then click **🔄 ROIs**.
- **Nothing happens on the device** — check the port in `config.local.yaml`
matches the connected Arduino, and that your sketch acts on the integers you
Expand Down
40 changes: 20 additions & 20 deletions docs/guides/user/external-trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ independent and can be used together.
## Do I need this? (short answer: probably not)

**No. The mode is OPT-IN and ships disabled.** If you leave the box unticked
nothing changes: recording starts when you click "Iniciar", exactly as before.
nothing changes: recording starts when you click "▶️ Start", exactly as before.
No Arduino is required, nothing blocks, no warning appears.

Ticking **"Usar Arduino"** does **not** enable the trigger either — they are two
separate checkboxes. You can use the Arduino purely for per-zone commands and
keep starting recordings by hand. Unticking "Usar Arduino" clears and disables
the trigger checkbox along with it.
Ticking **"Use Arduino for synchronization"** does **not** enable the trigger
either — they are two separate checkboxes. You can use the Arduino purely for
per-zone commands and keep starting recordings by hand. Unticking "Use Arduino
for synchronization" clears and disables the trigger checkbox along with it.

## The contract: your sketch must SPEAK

Expand Down Expand Up @@ -77,16 +77,16 @@ To stop from hardware, send `Serial.println(0)` the same way. If you never send

## Step by step

1. **In the wizard** (step 3, "Configuração de Gravação ao Vivo"):
- tick **"Usar Arduino para sincronização"** — the port is detected and
1. **In the wizard** (step 3, "Live Recording Configuration"):
- tick **"Use Arduino for synchronization"** — the port is detected and
preselected automatically (the app prefers the one that answers the
handshake and has "Arduino" in its description);
- click **"Testar"** to confirm the port opens;
- tick **"Modo de Gatilho Externo (External Trigger)"**.
- click **"🔌 Test"** to confirm the port opens;
- tick **"External Trigger Mode"**.
2. **Finish the wizard** and open the project. The port is opened at load time.
3. **In the Progress grid**, click a subject and then **"▶️ Iniciar"**.
3. **In the Progress grid**, click a subject and then **"▶️ Start"**.
- Recording does **not** start. The notice
**"Aguardando sinal externo... (porta COMx)"** appears.
**"Waiting for external signal... (port COMx)"** appears.
- Zones are requested BEFORE this wait — the polygon must be ready before we
sit waiting for a signal.
4. **Fire the trigger.** On receiving `1`, recording begins.
Expand Down Expand Up @@ -114,24 +114,24 @@ analysis time.

| Situation | Message | What to do |
| --------- | ------- | ---------- |
| Trigger on, **"Usar Arduino" off** | "…exige um Arduino configurado" | Enable the Arduino in the project, or turn the trigger off |
| Trigger on, Arduino on, **port not connected** | "…o Arduino não está conectado (porta COMx)" | Check the cable and that no other program holds the port; reopen the project |
| Trigger on, **"Use Arduino for synchronization" off** | "External trigger mode requires a configured Arduino." | Enable the Arduino in the project, or turn the trigger off |
| Trigger on, Arduino on, **port not connected** | "The Arduino is not connected — check the cable and whether the port is in use by another program." | Check the cable and that no other program holds the port; reopen the project |

The second case is common and quiet: if the cable is loose when you open the
project, a "modo offline" warning appears and the project opens anyway. Without
this refusal the session would arm and wait for a signal that has no way to
arrive.
project, a "Could not connect to the Arduino on port {port}. Running in
offline mode." warning appears and the project opens anyway. Without this
refusal the session would arm and wait for a signal that has no way to arrive.

## Troubleshooting

| Symptom | Likely cause |
| ------- | ------------ |
| Stuck on "Aguardando sinal externo" forever | The sketch is not sending a bare number. `Serial.println("1")` with quotes is text, not a trigger — check in the IDE's Serial Monitor |
| Nothing happens and no notice appears | The trigger is not enabled in the project; check "Config. Avançadas" / the project JSON |
| "Não foi possível conectar" when opening the project | Port held by the Arduino IDE's Serial Monitor — close it (one program per port) |
| Stuck on "Waiting for external signal... (port COMx)" forever | The sketch is not sending a bare number. `Serial.println("1")` with quotes is text, not a trigger — check in the IDE's Serial Monitor |
| Nothing happens and no notice appears | The trigger is not enabled in the project; check the "Advanced Settings" tab / the project JSON |
| "Could not connect to the Arduino on port {port}. Running in offline mode." when opening the project | Port held by the Arduino IDE's Serial Monitor — close it (one program per port) |
| Fires on its own, untouched | Button pin declared as `INPUT` instead of `INPUT_PULLUP` — a floating pin oscillates |
| Fires with a long delay | `delay()` inside `loop()`. Use `millis()` |
| DRerio logs the event but does not record | No session armed. The `1` only counts after "▶️ Iniciar"; before that it is logged and ignored |
| DRerio logs the event but does not record | No session armed. The `1` only counts after "▶️ Start"; before that it is logged and ignored |

## References

Expand Down
Loading
Loading