Usage¶
Uploading parameters to the device¶
Two methods upload the current in-memory channel and trigger configs to the device.
sync_all_params() — bulk upload (preferred)¶
Sends all parameters in a single serial write. Faster and less error-prone than iterating parameter by parameter.
pp.channel_configs[0].phase1Voltage = 5.0
pp.channel_configs[0].phase1Duration = 0.002
pp.sync_all_params()
upload_all() — per-parameter upload¶
Sends one serial round-trip per parameter. Use when you need to confirm each parameter individually, or for compatibility with older firmware.
program_one_param() — single parameter update¶
Updates a single parameter on a single channel without uploading everything.
set_resting_voltage() — convenience wrapper¶
set_fixed_voltage() — immediate DC output¶
Sets a channel to a fixed DC voltage immediately, outside of any pulse train sequence.
Triggering channels¶
Software trigger — selected channels¶
Software trigger — all channels¶
Stopping output¶
Continuous output mode¶
Keep a channel running continuously until stopped:
Trigger channel configuration¶
Set the trigger mode for a trigger channel (0 or 1):
Trigger modes: 0 = normal, 1 = toggle, 2 = pulse-gated.
Config file I/O¶
Save current config¶
pp.save_config("params.json") # JSON
pp.save_config("params.yaml") # YAML (requires pypulsepal[yaml])
Load config from file and apply¶
Load config without a device connection¶
from pypulsepal.config_io import load_config
from pypulsepal import PulsePal
cfg = load_config("params.json")
pp = PulsePal.from_config(cfg, serial_port="/dev/ttyACM0")
from_config connects, applies the config, and calls sync_all_params() in one step.
Reset to defaults¶
Resets all channel and trigger configs to factory defaults and syncs to the device.
Saving device state¶
save_settings() sends the disconnect opcode (81), which instructs the firmware to save current RAM parameters. The context manager calls this automatically on exit.