---
title: "DigitalInput (_DigitalInput class)"
canonical: "https://docs.cuesystem.com/space/CVCHELP/518881421/DigitalInput%20(_DigitalInput%20class)"
format: markdown
---
> Macro (toc)

---

# IsClosed

The function True, if the input/output pin is closed to the ground. 

#### Syntax 

```visualbasic
Function IsClosed() As Boolean
```

#### Return value 

[<u>Boolean</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean) It is True if the input/output pin is closed. It is False if the input/output pin is open. 

# OnClose

This event is fired by the system when the digital input is closed.  

#### Syntax 

```
Process OnClose ()
```

#### Example 

```visualbasic
// user event handler OnClose 
Private Process DigitalInput_OnClose(  ) Link Sensor1.OnClose 
  // user event handler part 
End Process
```

# OnOpen

This event is fired by the system when the digital input is opened.  

#### Syntax 

```visualbasic
Process OnOpen()
```

#### Example 

```visualbasic
// user event handler OnOpen 
Private Process DigitalInput_OnOpen(  ) Link Sensor1.OnOpen 
  // user event handler part 
End Process
```

# WaitWhileClosed

The function waits for the time the input pin is closed. It is possible to specify a maximal timeout for the waiting. 

#### Syntax 

```visualbasic
Function WaitWhileClosed(Optional timeout As Time := _TIME_INFINITE) As Boolean
```

#### Parameters 

timeout 

[<u>Time</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time) Optional, The timeout is the maximal time to wait. If the time interval exceeds the specified timeout, the function returns even if the input pin is still in the closed state. 

#### Return value 

[<u>Boolean</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)  

**True** The functions returns normally. The input pin has been opened. 

**False** The timeout has been exceeded. The input pin is still closed. 

# WaitWhileOpened

The function waits while the input pin is open. The wait timeout can be limited to the timeout time. 

#### Syntax* *

```visualbasic
Function WaitWhileOpened(Optional timeout As Time := _TIME_INFINITE) As Boolean
```

#### Parameters 

timeout 

[<u>Time</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time) Optional, The timeout is the maximal time to wait. If the time interval exceeds the specified timeout, the function returns even if the input pin is still in the open state. 

#### Return value 

[<u>Boolean</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)  

**True** The functions returns normally. The input pin has been closed. 

**False** The timeout has been exceeded. The input pin is still open.