# get – read channel value

> Reads a channel value with performance metrics — can take several samples and log latency to CSV.

_Source: E-Sharp (esharp.se) · Accordion Shell (CLI)_


## Description

The `get` command retrieves the current value of a specific channel with performance metrics. It can capture multiple samples and provides detailed timing statistics.

## Syntax

```bash
get --channel <channel_name> [options]
```

## Required Options

| Option | Short | Description |
| --- | --- | --- |
| `--channel` | `-c` | The name or alias of the channel to measure |

## Optional Options

| Option | Short | Description | Default |
| --- | --- | --- | --- |
| `--samples` | `-s` | Number of samples to capture | `1` |
| `--detailed` | `-d` | Enable detailed network timing analysis | `false` |
| `--log-file` | `-l` | Path to a CSV file for logging latency over time (appends if file exists) | - |
| `--interval` | `-i` | Delay in milliseconds between samples | `0` |

## Examples

```bash
get --channel "VOLTAGE_SENSOR_1"
get --channel "TEMPERATURE_1" --samples 100
get -c "ADC_CH0" -s 1000
get -c "TEMPERATURE" -s 100 -i 100
get -c "VOLTAGE" -s 50 -d
get -c "CURRENT_SENSE" -s 1000 -l "latency_log.csv"
get -c "ADC_CH0" -s 500 -i 10 -l "adc_timing.csv" -d
```

## Output Format

### Single Sample

```
Reading channel: VOLTAGE_SENSOR_1

3.3000 (2.15 ms)
```

### Multiple Samples

```
Reading channel: VOLTAGE_SENSOR_1

3.3001 (2.10 ms)
3.3002 (2.15 ms)
...

Average: 2.14 ms over 100 samples
```

### CSV Log Output

When using `--log-file`, the CSV file contains:

```
Timestamp,Channel,LatencyMs
2024-01-15 10:30:45.123,ADC_CH0,2.150
...
```

## Performance Metrics

| Metric | Description |
| --- | --- |
| Per-sample latency | Time for each individual sample acquisition (shown in parentheses) |
| Average latency | Mean time across all samples (shown when samples > 1) |

## Channel Name Resolution

The command uses regex matching to find channels. If `VOLTAGE` is provided, it matches the first channel containing "VOLTAGE". For exact matching, use the full channel name.

## Notes

- Requires an active connection (use `init` first)
- Samples are captured sequentially (not parallel)
- Timing includes network/communication overhead

## Error Handling

- **Channel not found**: Check channel name or use `list` to see available channels
- **Not connected**: Run `init` command first
- **Timeout**: Channel may not be responding
