Import LinuxCNC source tree
This commit is contained in:
21
configs/sim/woodpecker/numstr.py
Normal file
21
configs/sim/woodpecker/numstr.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
import hal
|
||||
import time
|
||||
h = hal.component("numstr")
|
||||
h.newpin("in", hal.HAL_S32, hal.HAL_IN)
|
||||
h.ready()
|
||||
tmp = 0
|
||||
try:
|
||||
while 1:
|
||||
# check program data every 0.01 seconds
|
||||
time.sleep(0.01)
|
||||
if h['in'] == 0:
|
||||
continue
|
||||
else:
|
||||
if h['in'] > tmp:
|
||||
f = open('/home/jura/line-number.txt','w')
|
||||
f.write(str(int(h['in'])))
|
||||
f.close()
|
||||
tmp = h['in']
|
||||
except KeyboardInterrupt:
|
||||
raise SystemExit
|
||||
Reference in New Issue
Block a user