Metadata-Version: 2.4
Name: semiswitch
Version: 1.0.1
Summary: API for SQN controller
Author: Umesh Puri
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# SQN Core Network Configuration and Uses Guide

This document contains the default settings and instructions for configuring the **SQN Core Controller**.

---

## 1. Default Network Settings
Upon shipping, the controller is pre-configured with the following factory defaults:

* **IP Address:** `192.168.10.29`
* **Port:** `80`
* **Subnet Mask:** `255.255.255.0`
* **Gateway:** `192.168.10.1`

---

## 2. Initial Computer Setup
To communicate with the controller, your computer must be on the same subnet. Configure your Ethernet adapter with the following static IP settings:

| Setting         | Value                                               |
| :-------------- | :-------------------------------------------------- |
| **IP Address** | `192.168.10.x` (any number **2–254**, except **29**) |
| **Subnet Mask** | `255.255.255.0`                                     |
| **Gateway** | `192.168.10.1`                                       |

---

## 3. Updating Controller Settings via Python
You can update the controller's network configuration using the `SemiSwitch` library. 

```python
import semiswitch as sq

# Connect to the controller using default settings
k = sq.Switch(ip_address='192.168.10.29', port=80)

# Set your new preferred network settings
# Replace 'x' with your specific network values
k.set_IP(
    ip_address='192.xxx.xxx.xxx',
    port=xxxx,
    mask='xxx.xxx.xxx.xxx',
    gateway='192.xxx.xxx.xxx'
)
```
```
Note: After running the script, a connection error will appear.This is expected. Once the script has executed, the controller will be accessible on the newly configured network.

```
#### *Quickly press the Reset button more than 10 times to restore the controller to its default network settings.*

## 4. Setting channels
SQN_CoreX controller has X number of channels and are named as dac_01, dac_02, dac_03 and so on.<br>
Each channel can be set from -10V to +10V.

```python
import semiswitch as sq
import time
k = sq.Switch(ip_address='192.168.10.29', port=80)
k.controller.dac_01.set_voltage(6.0) # set Channel 01 to +6.0V
time.sleep(2) #sleep 2 seconds
k.controller.dac_02.set_voltage(-6.0) # set Channel 02 to -6.0V
k.close() #close socket
```

Multiple channels can also be configured simultaneously
```python
import semiswitch as sq
import time
k = sq.Switch(ip_address='192.168.10.29', port=80)

#create groups of channels   dac_01, dac_03, dac_02, dac_07
channels = sq.DACChannels(pins=[k.controller.dac_01,k.controller.dac_03,
                            k.controller.dac_02,k.controller.dac_07]) 
#set dac_01 = 1V, dac_03 = 2V, dac_02 = 3V, dac_07 = 4V
channels.set_voltage([1.0,2.0,3.0,4.0])             
time.sleep(2)
#set all channels  to 0V
k.set_all_zero()
#set dac_01, dac_03, dac_02, dac_07 all to 5V
channels.set_voltage(5)
#close socket
k.close()

```

# 5. Setting RF switch
Four RF switch ports are available (output_0-3). The controller allows only one active port at a time; switching to a new port will automatically turn off the previous selection.
```python 
import semiswitch as sq
import time
k = sq.Switch(ip_address='192.168.10.29', port=80)
#switch off all the RF ports
k.open_all()
#switch on the output_0 port
k.output_0.close()
time.sleep(2)
#switch on the output_1 port
k.output_1.close()
#switch off all the RF port
k.open_all()
k.close()
```









   

