# How to give digital high/low from DIO pins from MATLAB

**URL:** https://forum.liquidinstruments.com/t/how-to-give-digital-high-low-from-dio-pins-from-matlab/1265
**Category:** Support & Troubleshooting
**Created:** [February 6, 2026, 8:16pm UTC](https://forum.liquidinstruments.com/t/how-to-give-digital-high-low-from-dio-pins-from-matlab/1265 "2026-02-06T20:16:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![alkmbozkurt](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@alkmbozkurt](https://forum.liquidinstruments.com/u/alkmbozkurt)
#### Post date: [February 6, 2026, 8:16pm UTC](https://forum.liquidinstruments.com/t/how-to-give-digital-high-low-from-dio-pins-from-matlab/1265/1 "2026-02-06T20:16:31Z")

</div>

**Moku model: Moku Delta**  
**Operating system: Windows 11**  
**Software version: 4.1.1**

\*\*Bug or support request description: I can give an arbitrary DIO pin High or Low from Logic Analyzer Instrument on GUI. But from MATLAB, every function regrading setting a pin yields an error.  
\*\*  
logic\_analyzer.set\_pin\_mode(9,‘PG1’)

I want to set the pin 9 High, what should I do?

---

<div class="post-metadata">

### Author: ![Dylan](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Dylan](https://forum.liquidinstruments.com/u/Dylan)
#### Post date: [February 6, 2026, 10:49pm UTC](https://forum.liquidinstruments.com/t/how-to-give-digital-high-low-from-dio-pins-from-matlab/1265/2 "2026-02-06T22:49:21Z")

</div>

Hello @alkmbozkurt ,

Thank you for reaching out to Liquid Instruments! What is the error that you are getting? The way to set the pin ‘high’ would be to generate a pattern of 1s, like we do in this [example](https://github.com/liquidinstruments/moku-examples/blob/main/matlab-api/logic_analyzer_basic.m). Namely, this section

```auto
patterns = [struct('pin', 1, 'pattern', repmat([1],1,1024)), ...
        struct('pin', 2, 'pattern', repmat([0],1,1024)), ...
        struct('pin', 3, 'pattern', repmat([1 0],1,512)), ...
        struct('pin', 4, 'pattern', repmat([0 1],1,512))];
    
    
    m.set_pattern_generator(1, patterns, 'divider', 8);
    
    m.set_pin_mode(1, "PG1");
    m.set_pin_mode(2, "PG1");
    m.set_pin_mode(3, "PG1");
    m.set_pin_mode(4, "PG1");

```

where Pin1 is set to be ‘high’ by creating a pattern of 1s. I hope this helps!

-Dylan

---

<div class="post-metadata">

### Author: ![alkmbozkurt](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@alkmbozkurt](https://forum.liquidinstruments.com/u/alkmbozkurt)
#### Post date: [February 6, 2026, 11:31pm UTC](https://forum.liquidinstruments.com/t/how-to-give-digital-high-low-from-dio-pins-from-matlab/1265/3 "2026-02-06T23:31:50Z")

</div>

the set\_pin\_mode function yields an error saying DigitalO is not the source. And when I try to set the source as DigitalIO from set\_source, it says that is not a valid source. This happens in MiM, but standalone works fine.

---

<div class="post-metadata">

### Author: ![Dylan](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Dylan](https://forum.liquidinstruments.com/u/Dylan)
#### Post date: [February 7, 2026, 12:55am UTC](https://forum.liquidinstruments.com/t/how-to-give-digital-high-low-from-dio-pins-from-matlab/1265/4 "2026-02-07T00:55:09Z")

</div>

@alkmbozkurt ,

This error comes from the fact that in single instrument mode, the source can be either the DIO, or the analog inputs. When using the DIO as the source, the ‘pin mode’ (input or output) is configured in the Logic Analyzer UI. You select each Pin and assign it to be either an input or an output (this is what the `set_pin_mode()` command does), and configure the pattern.

In Multi-Instrument mode, the source can be the DIO, the analog outputs, another instrument output, etc. Because of this, the input/output source is not determined in the Logic Analyzer UI, but rather in the Multi-Instrument UI. Whatever you have connected to the input/output of the Logic Analyzer is going to be the ‘source’. The configuration of the DIO will be done in the Multi-Instrument UI.

 ![Screenshot 2026-02-06 at 4.44.57 PM](https://canada1.discourse-cdn.com/flex035/uploads/liquidinstruments/original/1X/85d7a2a0a33d266aeaef313b81ab6487614b0434.png)

This means that the `set_pin_mode()` function isn’t used in the Multi-instrument context. To set the ‘pin mode’, you will use the `set_dio()` command to set the direction of the pins (equivalent of `set_pin_mode()`). Here is an example with Python where I set Pin 1 to be an output with a ‘high’ pattern configured.

```auto
i=MultiInstrument('192.168.2.37', force_connect=True, platform_id=3)

la=i.set_instrument(1, LogicAnalyzer)

connections=[dict(source='Slot1OutA', destination='DIO1')]

i.set_connections(connections=connections)

## Set Pin1 as output and Pins2-16 as inputs
direction=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

i.set_dio(direction=direction)

patterns=[{'pin': 1, 'pattern': [1]*8}]

la.set_pattern_generator(1, patterns=patterns, divider=250)

i.relinquish_ownership()

```

I hope this makes sense!

-Dylan
