# NI analog read task

> Learn how to acquire analog data from NI devices with Synnax.

This task follows the standard [task lifecycle](https://docs.synnaxlabs.com/reference/driver/task-basics#task-lifecycle).

## Task configuration reference

| Parameter     | Type   | Required | Default | Description                                                   |
| ------------- | ------ | -------- | ------- | ------------------------------------------------------------- |
| `sample_rate` | number | No       | `10`    | Samples per second (Hz), determined by module                 |
| `stream_rate` | number | No       | `5`     | Rate data is streamed to Synnax (Hz), must be ≤ `sample_rate` |
| `channels`    | array  | Yes      | -       | List of analog input channel configurations                   |

## Channel types reference

Accelerometer ([`ai_accel`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gafb775e5a6d567ec88f38192356b47eaf.html))

| Parameter              | Type   | Required | Default       | Description                                             |
| ---------------------- | ------ | -------- | ------------- | ------------------------------------------------------- |
| `channel`              | number | Yes      | -             | Synnax channel key                                      |
| `device`               | string | Yes      | -             | Device identifier                                       |
| `port`                 | number | Yes      | -             | Physical port                                           |
| `min_val`              | number | No       | `0`           | Minimum acceleration                                    |
| `max_val`              | number | No       | `1`           | Maximum acceleration                                    |
| `terminal_config`      | enum   | No       | `Cfg_Default` | Terminal configuration                                  |
| `sensitivity`          | number | No       | `0`           | Sensor sensitivity                                      |
| `sensitivity_units`    | enum   | No       | `mVoltsPerG`  | `mVoltsPerG`, `VoltsPerG`                               |
| `units`                | enum   | No       | `g`           | `g`, `MetersPerSecondSquared`, `InchesPerSecondSquared` |
| `current_excit_source` | enum   | No       | `Internal`    | `Internal`, `External`, `None`                          |
| `current_excit_val`    | number | No       | `0`           | Excitation current (Amps)                               |
| `custom_scale`         | object | No       | -             | Custom scaling                                          |

Accelerometer 4-wire DC voltage ([`ai_accel_4_wire_dc_voltage`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gaf3c2e5588e3464f607734acd27d52f79.html))

| Parameter              | Type    | Required | Default       | Description                                             |
| ---------------------- | ------- | -------- | ------------- | ------------------------------------------------------- |
| `channel`              | number  | Yes      | -             | Synnax channel key                                      |
| `device`               | string  | Yes      | -             | Device identifier                                       |
| `port`                 | number  | Yes      | -             | Physical port                                           |
| `min_val`              | number  | No       | `0`           | Minimum acceleration                                    |
| `max_val`              | number  | No       | `1`           | Maximum acceleration                                    |
| `terminal_config`      | enum    | No       | `Cfg_Default` | Terminal configuration                                  |
| `units`                | enum    | No       | `g`           | `g`, `MetersPerSecondSquared`, `InchesPerSecondSquared` |
| `sensitivity`          | number  | No       | `0`           | Sensor sensitivity                                      |
| `sensitivity_units`    | enum    | No       | `mVoltsPerG`  | `mVoltsPerG`, `VoltsPerG`                               |
| `voltage_excit_source` | enum    | No       | `Internal`    | `Internal`, `External`, `None`                          |
| `voltage_excit_val`    | number  | No       | `0`           | Excitation voltage (Volts)                              |
| `scaled_by_excitation` | boolean | No       | `false`       | Scale the reading by the excitation voltage             |
| `custom_scale`         | object  | No       | -             | Custom scaling                                          |

Accelerometer charge ([`ai_accel_charge`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga5d74e4c3c40c2aaef12c5dab3d8f8277.html))

| Parameter           | Type   | Required | Default            | Description                                                                                          |
| ------------------- | ------ | -------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
| `channel`           | number | Yes      | -                  | Synnax channel key                                                                                   |
| `device`            | string | Yes      | -                  | Device identifier                                                                                    |
| `port`              | number | Yes      | -                  | Physical port                                                                                        |
| `min_val`           | number | No       | `0`                | Minimum acceleration                                                                                 |
| `max_val`           | number | No       | `1`                | Maximum acceleration                                                                                 |
| `terminal_config`   | enum   | No       | `Cfg_Default`      | Terminal configuration                                                                               |
| `units`             | enum   | No       | `g`                | `g`, `MetersPerSecondSquared`, `InchesPerSecondSquared`                                              |
| `sensitivity`       | number | No       | `0`                | Sensor sensitivity                                                                                   |
| `sensitivity_units` | enum   | No       | `PicoCoulombsPerG` | `PicoCoulombsPerG`, `PicoCoulombsPerMetersPerSecondSquared`, `PicoCoulombsPerInchesPerSecondSquared` |
| `custom_scale`      | object | No       | -                  | Custom scaling                                                                                       |

Bridge ([`ai_bridge`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gab4d2a28bcc4212e7787808315471db67.html))

| Parameter                   | Type   | Required | Default         | Description                                 |
| --------------------------- | ------ | -------- | --------------- | ------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                          |
| `device`                    | string | Yes      | -               | Device identifier                           |
| `port`                      | number | Yes      | -               | Physical port                               |
| `min_val`                   | number | No       | `0`             | Minimum value                               |
| `max_val`                   | number | No       | `1`             | Maximum value                               |
| `units`                     | enum   | No       | `mVoltsPerVolt` | `mVoltsPerVolt`, `VoltsPerVolt`             |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge` |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`              |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                  |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms), must be > 0      |
| `custom_scale`              | object | No       | -               | Custom scaling                              |

Charge ([`ai_charge`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga4e2aeb0cb00398ba8f132c5407ea5d58.html))

| Parameter         | Type   | Required | Default       | Description                |
| ----------------- | ------ | -------- | ------------- | -------------------------- |
| `channel`         | number | Yes      | -             | Synnax channel key         |
| `device`          | string | Yes      | -             | Device identifier          |
| `port`            | number | Yes      | -             | Physical port              |
| `min_val`         | number | No       | `0`           | Minimum charge             |
| `max_val`         | number | No       | `1`           | Maximum charge             |
| `terminal_config` | enum   | No       | `Cfg_Default` | Terminal configuration     |
| `units`           | enum   | No       | `Coulombs`    | `Coulombs`, `PicoCoulombs` |
| `custom_scale`    | object | No       | -             | Custom scaling             |

Current ([`ai_current`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gadc9361c4cad612aeae3abe022076f5eb.html))

| Parameter                | Type   | Required | Default       | Description                          |
| ------------------------ | ------ | -------- | ------------- | ------------------------------------ |
| `channel`                | number | Yes      | -             | Synnax channel key                   |
| `device`                 | string | Yes      | -             | Device identifier                    |
| `port`                   | number | Yes      | -             | Physical port                        |
| `min_val`                | number | No       | `0`           | Minimum current (Amps)               |
| `max_val`                | number | No       | `1`           | Maximum current (Amps)               |
| `terminal_config`        | enum   | No       | `Cfg_Default` | Terminal configuration               |
| `shunt_resistor_loc`     | enum   | No       | `Default`     | `Default`, `Internal`, `External`    |
| `ext_shunt_resistor_val` | number | No       | `1`           | External shunt resistor value (Ohms) |
| `custom_scale`           | object | No       | -             | Custom scaling                       |

Current RMS ([`ai_current_rms`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gaef068e8b2360f0164842a72fd44f5374.html))

| Parameter                | Type   | Required | Default       | Description                          |
| ------------------------ | ------ | -------- | ------------- | ------------------------------------ |
| `channel`                | number | Yes      | -             | Synnax channel key                   |
| `device`                 | string | Yes      | -             | Device identifier                    |
| `port`                   | number | Yes      | -             | Physical port                        |
| `min_val`                | number | No       | `0`           | Minimum current (Amps)               |
| `max_val`                | number | No       | `1`           | Maximum current (Amps)               |
| `terminal_config`        | enum   | No       | `Cfg_Default` | Terminal configuration               |
| `shunt_resistor_loc`     | enum   | No       | `Default`     | `Default`, `Internal`, `External`    |
| `ext_shunt_resistor_val` | number | No       | `1`           | External shunt resistor value (Ohms) |
| `custom_scale`           | object | No       | -             | Custom scaling                       |

Force bridge polynomial ([`ai_force_bridge_polynomial`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga407b87343cc271196c53089ff2f9b383.html))

| Parameter                   | Type   | Required | Default         | Description                                                |
| --------------------------- | ------ | -------- | --------------- | ---------------------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                                         |
| `device`                    | string | Yes      | -               | Device identifier                                          |
| `port`                      | number | Yes      | -               | Physical port                                              |
| `min_val`                   | number | No       | `0`             | Minimum force                                              |
| `max_val`                   | number | No       | `1`             | Maximum force                                              |
| `units`                     | enum   | No       | `Newtons`       | Force units (`Newtons`, `Pounds`, `KilogramForce`)         |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge`                |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`                             |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                                 |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms)                                  |
| `forward_coeffs`            | array  | No       | `[]`            | Polynomial coefficients from electrical to physical values |
| `reverse_coeffs`            | array  | No       | `[]`            | Polynomial coefficients from physical to electrical values |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt` | Electrical units                                           |
| `physical_units`            | enum   | No       | `Newtons`       | Physical units                                             |
| `custom_scale`              | object | No       | -               | Custom scaling                                             |

Force bridge table ([`ai_force_bridge_table`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga87df6b93520dde3b4e4cfbf99e3cdb66.html))

| Parameter                   | Type   | Required | Default         | Description                                        |
| --------------------------- | ------ | -------- | --------------- | -------------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                                 |
| `device`                    | string | Yes      | -               | Device identifier                                  |
| `port`                      | number | Yes      | -               | Physical port                                      |
| `min_val`                   | number | No       | `0`             | Minimum force                                      |
| `max_val`                   | number | No       | `1`             | Maximum force                                      |
| `units`                     | enum   | No       | `Newtons`       | Force units (`Newtons`, `Pounds`, `KilogramForce`) |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge`        |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`                     |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                         |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms)                          |
| `electrical_vals`           | array  | No       | `[]`            | Electrical values for table                        |
| `physical_vals`             | array  | No       | `[]`            | Physical values for table                          |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt` | Electrical units                                   |
| `physical_units`            | enum   | No       | `Newtons`       | Physical units                                     |
| `custom_scale`              | object | No       | -               | Custom scaling                                     |

Force bridge two-point linear ([`ai_force_bridge_two_point_lin`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga2e610b43e3c00dac59d46de4c609b2ad.html))

| Parameter                   | Type   | Required | Default         | Description                                        |
| --------------------------- | ------ | -------- | --------------- | -------------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                                 |
| `device`                    | string | Yes      | -               | Device identifier                                  |
| `port`                      | number | Yes      | -               | Physical port                                      |
| `min_val`                   | number | No       | `0`             | Minimum force                                      |
| `max_val`                   | number | No       | `1`             | Maximum force                                      |
| `units`                     | enum   | No       | `Newtons`       | Force units (`Newtons`, `Pounds`, `KilogramForce`) |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge`        |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`                     |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                         |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms)                          |
| `first_electrical_val`      | number | No       | `0`             | First electrical value                             |
| `second_electrical_val`     | number | No       | `1`             | Second electrical value                            |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt` | Electrical units                                   |
| `first_physical_val`        | number | No       | `0`             | First physical value                               |
| `second_physical_val`       | number | No       | `1`             | Second physical value                              |
| `physical_units`            | enum   | No       | `Newtons`       | Physical units                                     |
| `custom_scale`              | object | No       | -               | Custom scaling                                     |

Force IEPE ([`ai_force_iepe`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gaa6ff3418553a70767e450e29bc380256.html))

| Parameter              | Type   | Required | Default           | Description                                        |
| ---------------------- | ------ | -------- | ----------------- | -------------------------------------------------- |
| `channel`              | number | Yes      | -                 | Synnax channel key                                 |
| `device`               | string | Yes      | -                 | Device identifier                                  |
| `port`                 | number | Yes      | -                 | Physical port                                      |
| `min_val`              | number | No       | `0`               | Minimum force                                      |
| `max_val`              | number | No       | `1`               | Maximum force                                      |
| `terminal_config`      | enum   | No       | `Cfg_Default`     | Terminal configuration                             |
| `units`                | enum   | No       | `Newtons`         | Force units (`Newtons`, `Pounds`, `KilogramForce`) |
| `sensitivity`          | number | No       | `0`               | Sensor sensitivity                                 |
| `sensitivity_units`    | enum   | No       | `mVoltsPerNewton` | `mVoltsPerNewton`, `mVoltsPerPound`                |
| `current_excit_source` | enum   | No       | `Internal`        | `Internal`, `External`, `None`                     |
| `current_excit_val`    | number | No       | `0`               | Excitation current (Amps)                          |
| `custom_scale`         | object | No       | -                 | Custom scaling                                     |

Frequency voltage ([`ai_freq_voltage`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gacfae87d4bb8abd35f8794543302fca06.html))

| Parameter         | Type   | Required | Default | Description                               |
| ----------------- | ------ | -------- | ------- | ----------------------------------------- |
| `channel`         | number | Yes      | -       | Synnax channel key                        |
| `device`          | string | Yes      | -       | Device identifier                         |
| `port`            | number | Yes      | -       | Physical port                             |
| `min_val`         | number | No       | `0`     | Minimum frequency (Hz)                    |
| `max_val`         | number | No       | `1`     | Maximum frequency (Hz)                    |
| `threshold_level` | number | No       | `0`     | Voltage level at which a cycle is counted |
| `hysteresis`      | number | No       | `0`     | Hysteresis around the threshold (Volts)   |
| `custom_scale`    | object | No       | -       | Custom scaling                            |

Microphone ([`ai_microphone`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga5853b2284aa81bf45003a815c092c46f.html))

| Parameter              | Type   | Required | Default       | Description                    |
| ---------------------- | ------ | -------- | ------------- | ------------------------------ |
| `channel`              | number | Yes      | -             | Synnax channel key             |
| `device`               | string | Yes      | -             | Device identifier              |
| `port`                 | number | Yes      | -             | Physical port                  |
| `terminal_config`      | enum   | No       | `Cfg_Default` | Terminal configuration         |
| `mic_sensitivity`      | number | No       | `0`           | Microphone sensitivity         |
| `max_snd_press_level`  | number | No       | `0`           | Maximum sound pressure level   |
| `current_excit_source` | enum   | No       | `Internal`    | `Internal`, `External`, `None` |
| `current_excit_val`    | number | No       | `0`           | Excitation current (Amps)      |
| `custom_scale`         | object | No       | -             | Custom scaling                 |

Pressure bridge polynomial ([`ai_pressure_bridge_polynomial`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga96308d972bed1172d1cfec606a7061a5.html))

| Parameter                   | Type   | Required | Default               | Description                                                |
| --------------------------- | ------ | -------- | --------------------- | ---------------------------------------------------------- |
| `channel`                   | number | Yes      | -                     | Synnax channel key                                         |
| `device`                    | string | Yes      | -                     | Device identifier                                          |
| `port`                      | number | Yes      | -                     | Physical port                                              |
| `min_val`                   | number | No       | `0`                   | Minimum pressure                                           |
| `max_val`                   | number | No       | `1`                   | Maximum pressure                                           |
| `units`                     | enum   | No       | `PoundsPerSquareInch` | `Pascals`, `PoundsPerSquareInch`, `Bar`                    |
| `bridge_config`             | enum   | No       | `FullBridge`          | `FullBridge`, `HalfBridge`, `QuarterBridge`                |
| `voltage_excit_source`      | enum   | No       | `Internal`            | `Internal`, `External`, `None`                             |
| `voltage_excit_val`         | number | No       | `0`                   | Excitation voltage (Volts)                                 |
| `nominal_bridge_resistance` | number | No       | `1`                   | Nominal resistance (Ohms)                                  |
| `forward_coeffs`            | array  | No       | `[]`                  | Polynomial coefficients from electrical to physical values |
| `reverse_coeffs`            | array  | No       | `[]`                  | Polynomial coefficients from physical to electrical values |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt`       | Electrical units                                           |
| `physical_units`            | enum   | No       | `PoundsPerSquareInch` | Physical units                                             |
| `custom_scale`              | object | No       | -                     | Custom scaling                                             |

Pressure bridge table ([`ai_pressure_bridge_table`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gad78a60f9ae005cd7533422aad9621f59.html))

| Parameter                   | Type   | Required | Default               | Description                                 |
| --------------------------- | ------ | -------- | --------------------- | ------------------------------------------- |
| `channel`                   | number | Yes      | -                     | Synnax channel key                          |
| `device`                    | string | Yes      | -                     | Device identifier                           |
| `port`                      | number | Yes      | -                     | Physical port                               |
| `min_val`                   | number | No       | `0`                   | Minimum pressure                            |
| `max_val`                   | number | No       | `1`                   | Maximum pressure                            |
| `units`                     | enum   | No       | `PoundsPerSquareInch` | `Pascals`, `PoundsPerSquareInch`, `Bar`     |
| `bridge_config`             | enum   | No       | `FullBridge`          | `FullBridge`, `HalfBridge`, `QuarterBridge` |
| `voltage_excit_source`      | enum   | No       | `Internal`            | `Internal`, `External`, `None`              |
| `voltage_excit_val`         | number | No       | `0`                   | Excitation voltage (Volts)                  |
| `nominal_bridge_resistance` | number | No       | `1`                   | Nominal resistance (Ohms)                   |
| `electrical_vals`           | array  | No       | `[]`                  | Electrical values for table                 |
| `physical_vals`             | array  | No       | `[]`                  | Physical values for table                   |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt`       | Electrical units                            |
| `physical_units`            | enum   | No       | `PoundsPerSquareInch` | Physical units                              |
| `custom_scale`              | object | No       | -                     | Custom scaling                              |

Pressure bridge two-point linear ([`ai_pressure_bridge_two_point_lin`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga58a8c28527b09fa4182a2fab25fbfe57.html))

| Parameter                   | Type   | Required | Default               | Description                                 |
| --------------------------- | ------ | -------- | --------------------- | ------------------------------------------- |
| `channel`                   | number | Yes      | -                     | Synnax channel key                          |
| `device`                    | string | Yes      | -                     | Device identifier                           |
| `port`                      | number | Yes      | -                     | Physical port                               |
| `min_val`                   | number | No       | `0`                   | Minimum pressure                            |
| `max_val`                   | number | No       | `1`                   | Maximum pressure                            |
| `units`                     | enum   | No       | `PoundsPerSquareInch` | `Pascals`, `PoundsPerSquareInch`, `Bar`     |
| `bridge_config`             | enum   | No       | `FullBridge`          | `FullBridge`, `HalfBridge`, `QuarterBridge` |
| `voltage_excit_source`      | enum   | No       | `Internal`            | `Internal`, `External`, `None`              |
| `voltage_excit_val`         | number | No       | `0`                   | Excitation voltage (Volts)                  |
| `nominal_bridge_resistance` | number | No       | `1`                   | Nominal resistance (Ohms)                   |
| `first_electrical_val`      | number | No       | `0`                   | First electrical value                      |
| `second_electrical_val`     | number | No       | `1`                   | Second electrical value                     |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt`       | Electrical units                            |
| `first_physical_val`        | number | No       | `0`                   | First physical value                        |
| `second_physical_val`       | number | No       | `1`                   | Second physical value                       |
| `physical_units`            | enum   | No       | `PoundsPerSquareInch` | Physical units                              |
| `custom_scale`              | object | No       | -                     | Custom scaling                              |

Resistance ([`ai_resistance`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gaa8454a1de839ded8669cce2b4b25cca4.html))

| Parameter              | Type   | Required | Default    | Description                    |
| ---------------------- | ------ | -------- | ---------- | ------------------------------ |
| `channel`              | number | Yes      | -          | Synnax channel key             |
| `device`               | string | Yes      | -          | Device identifier              |
| `port`                 | number | Yes      | -          | Physical port                  |
| `min_val`              | number | No       | `0`        | Minimum resistance (Ohms)      |
| `max_val`              | number | No       | `1`        | Maximum resistance (Ohms)      |
| `resistance_config`    | enum   | No       | `2Wire`    | `2Wire`, `3Wire`, `4Wire`      |
| `current_excit_source` | enum   | No       | `Internal` | `Internal`, `External`, `None` |
| `current_excit_val`    | number | No       | `0`        | Excitation current (Amps)      |
| `custom_scale`         | object | No       | -          | Custom scaling                 |

RTD ([`ai_rtd`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga3111dddf4f6eef35801096d09db7d574.html))

| Parameter              | Type   | Required | Default    | Description                                                |
| ---------------------- | ------ | -------- | ---------- | ---------------------------------------------------------- |
| `channel`              | number | Yes      | -          | Synnax channel key                                         |
| `device`               | string | Yes      | -          | Device identifier                                          |
| `port`                 | number | Yes      | -          | Physical port                                              |
| `min_val`              | number | No       | `0`        | Minimum temperature                                        |
| `max_val`              | number | No       | `1`        | Maximum temperature                                        |
| `units`                | enum   | No       | `DegC`     | `DegC`, `DegF`, `Kelvins`, `DegR`                          |
| `rtd_type`             | enum   | No       | `Pt3750`   | `Pt3750`, `Pt3851`, `Pt3911`, `Pt3916`, `Pt3920`, `Pt3928` |
| `r0`                   | number | No       | `0`        | Sensor resistance at 0 degrees Celsius (Ohms)              |
| `resistance_config`    | enum   | No       | `2Wire`    | `2Wire`, `3Wire`, `4Wire`                                  |
| `current_excit_source` | enum   | No       | `Internal` | `Internal`, `External`, `None`                             |
| `current_excit_val`    | number | No       | `0`        | Excitation current (Amps)                                  |

Strain gauge ([`ai_strain_gauge`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gab03c96b23cedb809011edc2df6fbef3e.html))

| Parameter                 | Type   | Required | Default       | Description                                                                                                        |
| ------------------------- | ------ | -------- | ------------- | ------------------------------------------------------------------------------------------------------------------ |
| `channel`                 | number | Yes      | -             | Synnax channel key                                                                                                 |
| `device`                  | string | Yes      | -             | Device identifier                                                                                                  |
| `port`                    | number | Yes      | -             | Physical port                                                                                                      |
| `min_val`                 | number | No       | `0`           | Minimum strain                                                                                                     |
| `max_val`                 | number | No       | `1`           | Maximum strain                                                                                                     |
| `strain_config`           | enum   | No       | `FullBridgeI` | `FullBridgeI`, `FullBridgeII`, `FullBridgeIII`, `HalfBridgeI`, `HalfBridgeII`, `QuarterBridgeI`, `QuarterBridgeII` |
| `voltage_excit_source`    | enum   | No       | `Internal`    | `Internal`, `External`, `None`                                                                                     |
| `voltage_excit_val`       | number | No       | `0`           | Excitation voltage (Volts)                                                                                         |
| `gage_factor`             | number | No       | `0`           | Gage factor                                                                                                        |
| `initial_bridge_voltage`  | number | No       | `0`           | Initial bridge voltage                                                                                             |
| `nominal_gage_resistance` | number | No       | `0`           | Nominal gage resistance (Ohms)                                                                                     |
| `poisson_ratio`           | number | No       | `0`           | Poisson’s ratio                                                                                                    |
| `lead_wire_resistance`    | number | No       | `0`           | Lead wire resistance (Ohms)                                                                                        |
| `custom_scale`            | object | No       | -             | Custom scaling                                                                                                     |

Temperature built-in sensor ([`ai_temp_builtin`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gaaa6a97a78f05458c86bb1c1b86ed2781.html))

| Parameter | Type   | Required | Default | Description                       |
| --------- | ------ | -------- | ------- | --------------------------------- |
| `channel` | number | Yes      | -       | Synnax channel key                |
| `device`  | string | Yes      | -       | Device identifier                 |
| `units`   | enum   | No       | `DegC`  | `DegC`, `DegF`, `Kelvins`, `DegR` |

Thermistor current excitation ([`ai_thermistor_iex`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gaf7dc57c48b676e22c788574fecb4f512.html))

| Parameter              | Type   | Required | Default    | Description                       |
| ---------------------- | ------ | -------- | ---------- | --------------------------------- |
| `channel`              | number | Yes      | -          | Synnax channel key                |
| `device`               | string | Yes      | -          | Device identifier                 |
| `port`                 | number | Yes      | -          | Physical port                     |
| `min_val`              | number | No       | `0`        | Minimum temperature               |
| `max_val`              | number | No       | `1`        | Maximum temperature               |
| `units`                | enum   | No       | `DegC`     | `DegC`, `DegF`, `Kelvins`, `DegR` |
| `resistance_config`    | enum   | No       | `2Wire`    | `2Wire`, `3Wire`, `4Wire`         |
| `current_excit_source` | enum   | No       | `Internal` | `Internal`, `External`, `None`    |
| `current_excit_val`    | number | No       | `0`        | Excitation current (Amps)         |
| `a`                    | number | No       | `0`        | First Steinhart-Hart coefficient  |
| `b`                    | number | No       | `0`        | Second Steinhart-Hart coefficient |
| `c`                    | number | No       | `0`        | Third Steinhart-Hart coefficient  |

Thermistor voltage excitation ([`ai_thermistor_vex`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga79514ce1961338c419f0d6e1157e7b83.html))

| Parameter              | Type   | Required | Default    | Description                       |
| ---------------------- | ------ | -------- | ---------- | --------------------------------- |
| `channel`              | number | Yes      | -          | Synnax channel key                |
| `device`               | string | Yes      | -          | Device identifier                 |
| `port`                 | number | Yes      | -          | Physical port                     |
| `min_val`              | number | No       | `0`        | Minimum temperature               |
| `max_val`              | number | No       | `1`        | Maximum temperature               |
| `units`                | enum   | No       | `DegC`     | `DegC`, `DegF`, `Kelvins`, `DegR` |
| `resistance_config`    | enum   | No       | `2Wire`    | `2Wire`, `3Wire`, `4Wire`         |
| `voltage_excit_source` | enum   | No       | `Internal` | `Internal`, `External`, `None`    |
| `voltage_excit_val`    | number | No       | `0`        | Excitation voltage (Volts)        |
| `a`                    | number | No       | `0`        | First Steinhart-Hart coefficient  |
| `b`                    | number | No       | `0`        | Second Steinhart-Hart coefficient |
| `c`                    | number | No       | `0`        | Third Steinhart-Hart coefficient  |
| `r1`                   | number | No       | `0`        | Reference resistor (Ohms)         |

Thermocouple ([`ai_thermocouple`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gab4d78206aa204316fecb740a123b38f7.html))

| Parameter           | Type   | Required | Default    | Description                                                                                                                                    |
| ------------------- | ------ | -------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `channel`           | number | Yes      | -          | Synnax channel key                                                                                                                             |
| `device`            | string | Yes      | -          | Device identifier                                                                                                                              |
| `port`              | number | Yes      | -          | Physical port                                                                                                                                  |
| `min_val`           | number | No       | `0`        | Minimum temperature                                                                                                                            |
| `max_val`           | number | No       | `1`        | Maximum temperature                                                                                                                            |
| `units`             | enum   | No       | `DegC`     | `DegC`, `DegF`, `Kelvins`, `DegR`                                                                                                              |
| `thermocouple_type` | enum   | No       | `J`        | `J`, `K`, `N`, `R`, `S`, `T`, `B`, `E`                                                                                                         |
| `cjc`               | object | No       | `built_in` | Cold junction compensation. One of `{"source": "built_in"}`, `{"source": "const_val", "val": <temp>}`, or `{"source": "chan", "port": <port>}` |

Torque bridge polynomial ([`ai_torque_bridge_polynomial`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga533bdb964404f08e0b2895a43a14b7b8.html))

| Parameter                   | Type   | Required | Default         | Description                                                |
| --------------------------- | ------ | -------- | --------------- | ---------------------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                                         |
| `device`                    | string | Yes      | -               | Device identifier                                          |
| `port`                      | number | Yes      | -               | Physical port                                              |
| `min_val`                   | number | No       | `0`             | Minimum torque                                             |
| `max_val`                   | number | No       | `1`             | Maximum torque                                             |
| `units`                     | enum   | No       | `NewtonMeters`  | `NewtonMeters`, `InchPounds`, `FootPounds`, `InchOunces`   |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge`                |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`                             |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                                 |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms)                                  |
| `forward_coeffs`            | array  | No       | `[]`            | Polynomial coefficients from electrical to physical values |
| `reverse_coeffs`            | array  | No       | `[]`            | Polynomial coefficients from physical to electrical values |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt` | Electrical units                                           |
| `physical_units`            | enum   | No       | `NewtonMeters`  | Physical units                                             |
| `custom_scale`              | object | No       | -               | Custom scaling                                             |

Torque bridge table ([`ai_torque_bridge_table`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga2d5889e6a7a4915ae340683b4cd1dc80.html))

| Parameter                   | Type   | Required | Default         | Description                                              |
| --------------------------- | ------ | -------- | --------------- | -------------------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                                       |
| `device`                    | string | Yes      | -               | Device identifier                                        |
| `port`                      | number | Yes      | -               | Physical port                                            |
| `min_val`                   | number | No       | `0`             | Minimum torque                                           |
| `max_val`                   | number | No       | `1`             | Maximum torque                                           |
| `units`                     | enum   | No       | `NewtonMeters`  | `NewtonMeters`, `InchPounds`, `FootPounds`, `InchOunces` |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge`              |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`                           |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                               |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms)                                |
| `electrical_vals`           | array  | No       | `[]`            | Electrical values for table                              |
| `physical_vals`             | array  | No       | `[]`            | Physical values for table                                |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt` | Electrical units                                         |
| `physical_units`            | enum   | No       | `NewtonMeters`  | Physical units                                           |
| `custom_scale`              | object | No       | -               | Custom scaling                                           |

Torque bridge two-point linear ([`ai_torque_bridge_two_point_lin`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gac0648326f7b53707894030813e538950.html))

| Parameter                   | Type   | Required | Default         | Description                                              |
| --------------------------- | ------ | -------- | --------------- | -------------------------------------------------------- |
| `channel`                   | number | Yes      | -               | Synnax channel key                                       |
| `device`                    | string | Yes      | -               | Device identifier                                        |
| `port`                      | number | Yes      | -               | Physical port                                            |
| `min_val`                   | number | No       | `0`             | Minimum torque                                           |
| `max_val`                   | number | No       | `1`             | Maximum torque                                           |
| `units`                     | enum   | No       | `NewtonMeters`  | `NewtonMeters`, `InchPounds`, `FootPounds`, `InchOunces` |
| `bridge_config`             | enum   | No       | `FullBridge`    | `FullBridge`, `HalfBridge`, `QuarterBridge`              |
| `voltage_excit_source`      | enum   | No       | `Internal`      | `Internal`, `External`, `None`                           |
| `voltage_excit_val`         | number | No       | `0`             | Excitation voltage (Volts)                               |
| `nominal_bridge_resistance` | number | No       | `1`             | Nominal resistance (Ohms)                                |
| `first_electrical_val`      | number | No       | `0`             | First electrical value                                   |
| `second_electrical_val`     | number | No       | `1`             | Second electrical value                                  |
| `electrical_units`          | enum   | No       | `mVoltsPerVolt` | Electrical units                                         |
| `first_physical_val`        | number | No       | `0`             | First physical value                                     |
| `second_physical_val`       | number | No       | `1`             | Second physical value                                    |
| `physical_units`            | enum   | No       | `NewtonMeters`  | Physical units                                           |
| `custom_scale`              | object | No       | -               | Custom scaling                                           |

Velocity IEPE ([`ai_velocity_iepe`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga0256a5337cbe48c93b7450f39f27386e.html))

| Parameter              | Type   | Required | Default                            | Description                                                      |
| ---------------------- | ------ | -------- | ---------------------------------- | ---------------------------------------------------------------- |
| `channel`              | number | Yes      | -                                  | Synnax channel key                                               |
| `device`               | string | Yes      | -                                  | Device identifier                                                |
| `port`                 | number | Yes      | -                                  | Physical port                                                    |
| `min_val`              | number | No       | `0`                                | Minimum velocity                                                 |
| `max_val`              | number | No       | `1`                                | Maximum velocity                                                 |
| `units`                | enum   | No       | `MetersPerSecond`                  | `MetersPerSecond`, `InchesPerSecond`                             |
| `terminal_config`      | enum   | No       | `Cfg_Default`                      | Terminal configuration                                           |
| `sensitivity`          | number | No       | `0`                                | Sensor sensitivity                                               |
| `sensitivity_units`    | enum   | No       | `MillivoltsPerMillimeterPerSecond` | `MillivoltsPerMillimeterPerSecond`, `MilliVoltsPerInchPerSecond` |
| `current_excit_source` | enum   | No       | `Internal`                         | `Internal`, `External`, `None`                                   |
| `current_excit_val`    | number | No       | `0`                                | Excitation current (Amps)                                        |
| `custom_scale`         | object | No       | -                                  | Custom scaling                                                   |

Voltage ([`ai_voltage`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga94c83a5df8579b4164e638018b7ee89f.html))

| Parameter         | Type   | Required | Default       | Description                                                                 |
| ----------------- | ------ | -------- | ------------- | --------------------------------------------------------------------------- |
| `channel`         | number | Yes      | -             | Synnax channel key                                                          |
| `device`          | string | Yes      | -             | Device identifier                                                           |
| `port`            | number | Yes      | -             | Physical port                                                               |
| `min_val`         | number | No       | `0`           | Minimum voltage (Volts)                                                     |
| `max_val`         | number | No       | `1`           | Maximum voltage (Volts)                                                     |
| `terminal_config` | enum   | No       | `Cfg_Default` | Terminal configuration (`Cfg_Default`, `RSE`, `NRSE`, `Diff`, `PseudoDiff`) |
| `custom_scale`    | object | No       | -             | Custom scaling                                                              |

Voltage RMS ([`ai_voltage_rms`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1gae3c40696c94f896a2c60784e3baf3905.html))

| Parameter         | Type   | Required | Default       | Description                                                                 |
| ----------------- | ------ | -------- | ------------- | --------------------------------------------------------------------------- |
| `channel`         | number | Yes      | -             | Synnax channel key                                                          |
| `device`          | string | Yes      | -             | Device identifier                                                           |
| `port`            | number | Yes      | -             | Physical port                                                               |
| `min_val`         | number | No       | `0`           | Minimum voltage (Volts)                                                     |
| `max_val`         | number | No       | `1`           | Maximum voltage (Volts)                                                     |
| `terminal_config` | enum   | No       | `Cfg_Default` | Terminal configuration (`Cfg_Default`, `RSE`, `NRSE`, `Diff`, `PseudoDiff`) |
| `custom_scale`    | object | No       | -             | Custom scaling                                                              |

Voltage with excitation ([`ai_voltage_with_excit`](https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/group__ni-daqmx__c__functions__channel__configuration__creation__create__analog__input__channels_1ga12a57904c16ebc47c62a788f5435ca0a.html))

| Parameter              | Type    | Required | Default       | Description                                 |
| ---------------------- | ------- | -------- | ------------- | ------------------------------------------- |
| `channel`              | number  | Yes      | -             | Synnax channel key                          |
| `device`               | string  | Yes      | -             | Device identifier                           |
| `port`                 | number  | Yes      | -             | Physical port                               |
| `min_val`              | number  | No       | `0`           | Minimum voltage (Volts)                     |
| `max_val`              | number  | No       | `1`           | Maximum voltage (Volts)                     |
| `terminal_config`      | enum    | No       | `Cfg_Default` | Terminal configuration                      |
| `bridge_config`        | enum    | No       | `FullBridge`  | `FullBridge`, `HalfBridge`, `QuarterBridge` |
| `voltage_excit_source` | enum    | No       | `Internal`    | `Internal`, `External`, `None`              |
| `voltage_excit_val`    | number  | No       | `0`           | Excitation voltage (Volts)                  |
| `scaled_by_excitation` | boolean | No       | `false`       | Scale the reading by the excitation voltage |
| `custom_scale`         | object  | No       | -             | Custom scaling                              |

## Important rules

* **One task per module** -> Only one running task can claim a module at a time.
* **Stream rate** -> For sample rates under 50 Hz, set the stream rate equal to the sample rate. Above that, keep the stream rate under 50 Hz.

## How-to

**Console**

[](https://synnax.nyc3.cdn.digitaloceanspaces.com/docs/device-drivers/ni/analog-read-task/ni-analog-read-dark.mp4#t=0.001)

**Python**

Configure and run task

```python
import synnax as sy
from synnax import ni

client = sy.Synnax()

# Retrieve devices
v_dev = client.devices.retrieve(name="Mod1_Voltage")
c_dev = client.devices.retrieve(name="Mod2_Current")
tc_dev = client.devices.retrieve(name="Mod1_TC")

# Create index and data channels
ai_time = client.channels.create(
    name="ai_time",
    is_index=True,
    data_type=sy.DataType.TIMESTAMP,
    retrieve_if_name_exists=True,
)
voltage_chan = client.channels.create(
    name="voltage_chan",
    index=ai_time.key,
    data_type=sy.DataType.FLOAT32,
    retrieve_if_name_exists=True,
)
current_chan = client.channels.create(
    name="current_chan",
    index=ai_time.key,
    data_type=sy.DataType.FLOAT32,
    retrieve_if_name_exists=True,
)
temp_chan = client.channels.create(
    name="temp_chan",
    index=ai_time.key,
    data_type=sy.DataType.FLOAT32,
    retrieve_if_name_exists=True,
)

# Create and configure task
task = ni.AnalogReadTask(
    name="NI Analog Read Task",
    sample_rate=sy.Rate.HZ * 100,
    stream_rate=sy.Rate.HZ * 25,
    channels=[
        ni.AIVoltageChannel(
            channel=voltage_chan.key,
            device=v_dev.key,
            port=0,
            min_val=-10.0,
            max_val=10.0,
            terminal_config="Diff",
        ),
        ni.AICurrentChannel(
            channel=current_chan.key,
            device=c_dev.key,
            port=0,
            min_val=0.004,
            max_val=0.02,
            shunt_resistor_loc="Internal",
            ext_shunt_resistor_val=249.0,
        ),
        ni.AIThermocoupleChannel(
            channel=temp_chan.key,
            device=tc_dev.key,
            port=0,
            units="DegC",
            thermocouple_type="J",
            cjc=ni.BuiltInCJC(),
        ),
    ],
)

client.tasks.configure(task)

# Start task and read data
with task.run():
    with client.open_streamer(["voltage_chan", "current_chan", "temp_chan"]) as streamer:
        for _ in range(10):
            frame = streamer.read()
            print(frame)
```

Edit task configuration

```python
# Retrieve existing task
task = client.tasks.retrieve(name="NI Analog Read Task")
task = ni.AnalogReadTask(internal=task)

# Update task-level configuration
task.config.auto_start = True
task.config.stream_rate = int(sy.Rate.HZ * 50)

# Update voltage channel configuration
task.config.channels[0].port = 1
task.config.channels[0].min_val = -5.0
task.config.channels[0].max_val = 5.0

# Update current channel configuration
task.config.channels[1].port = 2
task.config.channels[1].min_val = 0.002
task.config.channels[1].max_val = 0.01

# Update thermocouple channel configuration
task.config.channels[2].port = 3
task.config.channels[2].thermocouple_type = "K"

# Apply changes
client.tasks.configure(task)
```

**TypeScript**

Configure and run task

```typescript
import { Synnax } from "@synnaxlabs/client";

const client = new Synnax();

// Retrieve devices
const [vDev] = await client.devices.retrieve({ names: ["Mod1_Voltage"] });
const [cDev] = await client.devices.retrieve({ names: ["Mod2_Current"] });
const [tcDev] = await client.devices.retrieve({ names: ["Mod1_TC"] });

// Create index and data channels
const aiTime = await client.channels.create(
  {
    name: "ai_time",
    isIndex: true,
    dataType: "timestamp",
  },
  { retrieveIfNameExists: true },
);

const voltageChan = await client.channels.create(
  {
    name: "voltage_chan",
    index: aiTime.key,
    dataType: "float32",
  },
  { retrieveIfNameExists: true },
);

const currentChan = await client.channels.create(
  {
    name: "current_chan",
    index: aiTime.key,
    dataType: "float32",
  },
  { retrieveIfNameExists: true },
);

const tempChan = await client.channels.create(
  {
    name: "temp_chan",
    index: aiTime.key,
    dataType: "float32",
  },
  { retrieveIfNameExists: true },
);

// Create and configure task
const task = await client.tasks.create({
  name: "NI Analog Read Task",
  rack: vDev.rack,
  type: "ni_analog_read",
  config: {
    sampleRate: 100,
    streamRate: 25,
    channels: [
      {
        type: "ai_voltage",
        channel: voltageChan.key,
        device: vDev.key,
        port: 0,
        minVal: -10.0,
        maxVal: 10.0,
        terminalConfig: "Diff",
      },
      {
        type: "ai_current",
        channel: currentChan.key,
        device: cDev.key,
        port: 0,
        minVal: 0.004,
        maxVal: 0.02,
        shuntResistorLoc: "Internal",
        extShuntResistorVal: 249.0,
      },
      {
        type: "ai_thermocouple",
        channel: tempChan.key,
        device: tcDev.key,
        port: 0,
        units: "DegC",
        thermocoupleType: "J",
        cjc: { source: "built_in" },
      },
    ],
  },
});

// Start task
await task.start();

// Read data
const streamer = await client.openStreamer([
  "voltage_chan",
  "current_chan",
  "temp_chan",
]);
for (let i = 0; i < 10; i++) {
  const frame = await streamer.read();
  console.log(frame);
}

// Stop task
await task.stop();
await streamer.close();
```

Edit task configuration

```typescript
import { ni } from "@synnaxlabs/client";

// Retrieve existing task
const task = await client.tasks.retrieve({ name: "NI Analog Read Task" });

// Parse the configuration into its typed form
const config = ni.analogReadConfigZ.parse(task.config);

// Update task-level configuration
config.autoStart = true;
config.streamRate = 50;

// Update voltage channel configuration
const voltage = config.channels[0] as ni.AIVoltageChannel;
voltage.port = 1;
voltage.minVal = -5.0;
voltage.maxVal = 5.0;

// Update current channel configuration
const current = config.channels[1] as ni.AICurrentChannel;
current.port = 2;
current.minVal = 0.002;
current.maxVal = 0.01;

// Update thermocouple channel configuration
const thermocouple = config.channels[2] as ni.AIThermocoupleChannel;
thermocouple.port = 3;
thermocouple.thermocoupleType = "K";

// Apply changes
await client.tasks.create({
  key: task.key,
  rack: task.rack,
  name: task.name,
  type: task.type,
  config,
});
```
