Elementary OS 설치 후 작업

nimf 설치

sudo apt-add-repository ppa:hodong/nimf
sudo apt update
sudo apt install nimf nimf-libhangul
im-config -n nimf

nimf-settings

트레이 아이콘 띄우기

sudo add-apt-repository ppa:yunnxx/elementary
sudo apt update
sudo apt install indicator-application wingpanel-indicator-ayatana

then you need to edit a file (i used nano, use any editor you want – avoiding a holy war)

sudo nano /etc/xdg/autostart/indicator-application.desktop

find the line

OnlyShowIn=Unity;GNOME;

and add Pantheon

OnlyShowIn=Unity;GNOME;Pantheon;

Modbus (pyModbusTCP)

설치

pip3 install pyModbusTCP

클라이언트 가동

from pyModbusTCP.client import ModbusClient
import sys

c = ModbusClient(host="localhost",port=502) #set host and port
if not c.is_open():
c.open()

if not c.is_open():
print("연결실패. 프로그램 종료")
sys.exit()

addr = 0 # 주소 할당 ( 0 to 65533 )
c.write_single_coil(addr,True) #코일 입력
c.write_single_register(addr,12345) #레지스트리 입력
c.write_multiple_coils(addr,[True,True,True]) # addr주소부터 주소값을 하나씩 늘려 리스트에 입력된값을 차례대로 할당
c.write_multiple_registers(addr,[11,222,333]) # addr주소부터 주소값을 하나씩 늘려 리스트에 입력된값을 차례대로 할당
n_read = 3 #읽어들일 값의 갯수
c.read_coils(addr,n_read)
c.read_holding_registers(addr,n_read)

c.close() #종료

서버 가동

 
from pyModbusTCP.server import ModbusServer

server = ModbusServer(host="192.168.aa.bb", port=502) #서버정보와 포트정보 입력. 서버는 localhost라고 쓰면 안되고, 아이피주소를 명시해야하는 듯
server.start()