ネクスモスフィア
  • 09 Jul 2024
  • 1 読む分

ネクスモスフィア


記事の要約

Nexmosphereデバイス を接続する

  • NexmosphereをUSB経由でメディアプレーヤーに接続します。
  • サードパーティのソフトウェアを介して接続をテストします。
    • 白蟻。
    • 追加のドライバーが必要になる場合があります。

NexmosphereデバイスをDiseに接続する

プレミアム

CXコンポーザー

スクリプト

関連するCOMポートを使用して、Nexmosphereデバイスをプレミアムプレーヤーに接続します。

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

送信されるシグナルコマンドを読み取ります。

for line in ser.read():
        time.sleep(0.5)
        packet = ser.readline()
        packet_clean = (packet.decode('utf').rstrip())
        print(packet.decode('utf').rstrip())
Diseを起動する前に、シロアリの接続を閉じてください。1つのCOMポートで一度に開くことができる接続は1つだけです。 

Nexmosphereデバイスを使用した制御

  1. スクリプト内で triggers を使用して、再生するコンテンツを制御します。
  2. この Dise methods library は、スクリプトで使用して、さらに制御できます。
  3. メディアプレーヤーをDiseムービーに追加してConnect the scriptします。
  4. DiseムービーをCXポータルにアップロードする
スクリプトを背景レイヤーまたは透明レイヤーとして実行します。
スクリプトの例:
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()

この記事は役に立ちましたか?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.