Skip to content

Commit

Permalink
Merge pull request #5 from mcci-usb/version1.0.1
Browse files Browse the repository at this point in the history
added examples
  • Loading branch information
vinaynmcci authored Oct 29, 2024
2 parents aba47d3 + b5e8a36 commit 3bd53e3
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 45 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Create a Python file and import the class library from package:
```python
from model2450lib import searchmodel
from model2450lib import model2450
import time
```

### Listed out the Model2450
Expand Down Expand Up @@ -90,4 +91,5 @@ sw1.get_version()

## Release History

- v1.0.1 update examples
- v1.0.0 initial release
36 changes: 36 additions & 0 deletions example/01_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# avalaible list of MCCI Switches with port number
# from model2450 import searchswitch

# import searchswitch
# import switch2450

import time
from model2450lib import searchmodel
from model2450lib import model2450
# found a list of available switches.
# using the port number open the switch.
dev_list = searchmodel.get_models()
print(dev_list)

# Replace 'COMX' with the appropriate COM port for Model2450
sw1 = model2450.Model2450('COM10')
# print("switch 2450 connected:", sw1)
# Connect the USB Switch
sw1.connect()
print("Connected switch 2450:")

sn= sw1.read_sn() # cmd for read serial number
print(sn)

time.sleep(1)
gread = sw1.get_read() # cmd for read the ambient light sensor
print(gread)

time.sleep(1)
glevel = sw1.get_level() # cmd for read the light level for detecting blank frames
print(glevel)

time.sleep(1)
gcolor = sw1.get_color() # display the color reading
print(gcolor)

44 changes: 44 additions & 0 deletions example/02_blackframes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@


# import searchswitch
# import switch2450

import time
from model2450lib import searchmodel
from model2450lib import model2450
# found a list of available switches.
# using the port number open the switch.
dev_list = searchmodel.get_models()
print(dev_list)

# Replace 'COMX' with the appropriate COM port for Model2450
sw1 = model2450.Model2450('COM10')
# print("switch 2450 connected:", sw1)
# Connect the USB Switch
sw1.connect()
print("Connected switch 2450:")

sn= sw1.read_sn() # cmd for read serial number
print(sn)

time.sleep(1)
gread = sw1.get_read() # cmd for read the ambient light sensor
print(gread)

time.sleep(1)
glevel = sw1.get_level() # cmd for read the light level for detecting blank frames
print(glevel)

time.sleep(1)
gcolor = sw1.get_color() # display the color reading
print(gcolor)


bc = sw1.set_run() # look for black frames
print("bc count started:")

time.sleep(10)
bc = sw1.set_stop() # stop looking for black frames and print the results

print(bc)

44 changes: 0 additions & 44 deletions example/test_model2450.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name='model2450lib',
version='1.0.0',
version='1.0.1',
description='API for MCCI Model2450',
author='Vinay N MCCI Corporation',
author_email='',
Expand Down

0 comments on commit 3bd53e3

Please sign in to comment.