def test_read(): sync_timeout = 1500 # *1000us = 1.5s drv_send_timeout = 500000 # *1us = 0.5s net_confirm_timeout = 1000 # *1000us = 1s lnet.init(2, 10, sync_timeout, drv_send_timeout, net_confirm_timeout) x = True for i in range(0, 10): # 10sec rc, msg = lnet.recv(2) if (rc != 0): print "lnet.recv(port) FAIL: rc= ", rc else: print "msg=", msg print handle_msg(msg)
import can_net_sync as cn import pmd_net_system as sys import time as t cn.init(1, 100, 100, 100, 100) msg = cn.recv(1) while(1): t.sleep(1) msg = cn.recv(1) if(msg[0] == 0): data = sys.config_read(msg[1][2]) print data[2]