Nexmosphere
- 14 Oct 2024
- 2 Minutes to read
- Print
Nexmosphere
- Updated on 14 Oct 2024
- 2 Minutes to read
- Print
Article summary
Did you find this summary helpful?
Thank you for your feedback
Connect a Nexmosphere device
- Connect the Nexmosphere to a media player via USB.
- Test the connection via a 3rd party software:
- Termite.
- Additional drivers may be required.
Connect a Nexmosphere Device to Dise
Premium
- Download and install the Premium player.
- Create a Display on the CX Portal.
CX Composer
- Download and install the CX Composer.
- Connect the Composer to the CX Portal.
Scripts
Connect the Nexmosphere device to a Premium player using the relevant COM port:
import serial
ser = serial.Serial(
port='COM3',\
baudrate=115200,\
parity=serial.PARITY_NONE,\
stopbits=serial.STOPBITS_ONE,\
xonxoff=True,\
bytesize=serial.EIGHTBITS,\
timeout=0)
print("connected to: " + ser.portstr)
count=1
Read the signal commands being sent:
for line in ser.read():
time.sleep(0.5)
packet = ser.readline()
packet_clean = (packet.decode('utf').rstrip())
print(packet.decode('utf').rstrip())
Close the termite connection before starting Dise. Only one connection can be opened over a single COM port at any time.
Control Dise Using the Nexmosphere Device
- Use triggers within a script to control what content plays.
- The Dise methods library can be used in the script for further controls.
- Connect the script to the media player by adding it to a Dise movie.
- Upload the Dise movie to the CX Portal
Run the script as a background or transparent layer.
Example script:
import serial
import time
loglevel = 'Warning'
#Connects to the serial port, Port can change to something else but the rest should be ok if using Nexmosphere
ser = serial.Serial(
port='COM3',\
baudrate=115200,\
parity=serial.PARITY_NONE,\
stopbits=serial.STOPBITS_ONE,\
xonxoff=True,\
bytesize=serial.EIGHTBITS,\
timeout=0)
#Prints out what port we are connected to
print("connected to: " + ser.portstr)
count=1
while DISEScript.ProcessEvents(1000) != 'Terminated':
for line in ser.read():
#Checks that the script is running and looking for packages
DISEScript.Log(loglevel, 'Looking for relevant packages!')
#Slows down the read of the packages to not overload the script, can be adjusted and probably lowered a bit for faster triggering
time.sleep(0.5)
#Reads the package and puts it in the variable 'Packet'
packet = ser.readline()
#Cleans the packet by decoding it as utf for readability
packet_clean = (packet.decode('utf').rstrip())
#Uncomment line below to see all packets that come in.
#DISEScript.Log(loglevel, packet.decode('utf').rstrip())
#Triggering part of the script, change the packetname to trigger based on different events on the Nexmosphere board
#Can use the logging part above to log all packets to see what the name for the different packets are and just read that in diselog
#Disescript.settrigger toggles the trigger set on player, "MAGNETIC_SENSOR" for example. Needs to be changed to the name of your triggers
#Triggers based on the Magnetic pick-up sensor, [7] is when you detach it [4] is when you put it back. On [4] we trigger the image off
if packet_clean == '003A[7]':
DISEScript.SetTrigger("MAGNETIC_SENSOR", True)
if packet_clean == '003A[4]':
DISEScript.SetTrigger("MAGNETIC_SENSOR", False)
#Trigger based on the RFID sensor, 007A[0] is if it is put on the senor and the [1] is if it has been removed and then we trigger off
if packet_clean == '007A[0]':
DISEScript.SetTrigger("RFID_1", True)
if packet_clean == '007A[1]':
DISEScript.SetTrigger("RFID_1", False)
#Trigger based on the Buttons Clicking the left button will trigger it on, clicking the right button will trigger it off
if packet_clean == '001A[17]':
DISEScript.SetTrigger("BUTTON", True)
if packet_clean == '001A[3]':
DISEScript.SetTrigger("BUTTON", False)
#Trigger based on the Light sensor, lifting it will trigger it on and putting it back will trigger it off
if packet_clean == '006A[3]':
DISEScript.SetTrigger("LIGHT_SENSOR", True)
if packet_clean == '006A[0]':
DISEScript.SetTrigger("LIGHT_SENSOR", False)
ser.close()
Was this article helpful?