set - Set Channel Value
Description
The set command writes a value to a specified channel. It's used to configure hardware settings, control digital I/O, and modify channel states.
Syntax
set --channel <channel_name> --value <value>
Required Options
| Option | Short | Description |
|---|---|---|
--channel |
-c |
The name or alias of the channel to set |
--value |
-v |
The value to write to the channel |
Examples
Set Digital Output
set --channel "GPIO_PIN_5" --value "1"
Set Analog Value
set --channel "DAC_OUTPUT" --value "2.5"
Set String Value
set --channel "DEVICE_NAME" --value "TestDevice"
Set Enumeration
set --channel "MODE_SELECT" --value "AUTO"
Using Short Options
set -c "ENABLE" -v "true"
Value Types
The command accepts various value types depending on the channel:
| Channel Type | Example Values |
|---|---|
| Boolean | "true", "false", "1", "0" |
| Integer | "0", "100", "-5" |
| Float/Double | "3.14", "2.5", "-1.23" |
| String | "any text", "DeviceName" |
| Enumeration | "OPTION1", "MODE_A" |
| Hexadecimal | "0xFF", "0x1A2B" |
Behavior
- Resolves the channel name
- Converts the value to the appropriate type
- Sends the value to the hardware
- Value is applied immediately
Channel Name Resolution
The channel parameter is trimmed of whitespace and passed directly to the hardware layer for resolution.
Common Use Cases
Control GPIO
# Turn LED on
set -c "LED_GREEN" -v "1"
# Turn LED off
set -c "LED_GREEN" -v "0"
Set Voltage
# Set DAC output to 1.8V
set -c "VOUT_DAC" -v "1.8"
Configure Mode
# Set device to test mode
set -c "OPERATING_MODE" -v "TEST"
Enable/Disable Features
# Enable watchdog
set -c "WATCHDOG_ENABLE" -v "true"
# Disable interrupts
set -c "INT_ENABLE" -v "false"
Notes
- Requires an active connection (use
initfirst) - Values are applied immediately
- Some channels may have restricted value ranges
- Hardware validation may reject invalid values
- Changes persist until reset or new value is set
Type Conversion
The hardware layer automatically handles type conversion:
- Boolean channels accept "true"/"false", "1"/"0"
- Numeric channels parse decimal and hexadecimal
- String channels accept any text
- Enumeration channels validate against allowed values
Validation
Hardware-level validation occurs for:
- Value range (min/max limits)
- Allowed enumeration values
- Data type compatibility
- Channel write permissions
Error Handling
Common errors:
- Channel not found: Verify channel name with
list - Invalid value: Check channel data type and valid range
- Read-only channel: Some channels cannot be written
- Value out of range: Hardware rejected the value
- Not connected: Run
initcommand first
Performance
- Set operations typically complete in 2-10 ms
- Network latency affects timing
- Bulk operations should use scripts