No changes between revisions
/Designs/Measuring_instruments/RMDS01C/SW/Host_controller/frequency_log.py
0,0 → 1,58
#!/usr/bin/python
 
import time
import datetime
import sys
from pymlab import config
 
#### Script Arguments ###############################################
 
if len(sys.argv) != 2:
sys.stderr.write("Invalid number of arguments.\n")
sys.stderr.write("Usage: %s PORT ADDRESS\n" % (sys.argv[0], ))
sys.exit(1)
 
port = eval(sys.argv[1])
#### Sensor Configuration ###########################################
 
cfg = config.Config(
port = port,
bus = [
{
"name": "counter",
"type": "acount02",
},
],
)
cfg.initialize()
 
print "LTS01 temperature sensor module example \r\n"
print "Temperature Humidity[%%] \r\n"
fcount = cfg.get_device("counter")
time.sleep(0.5)
 
#### Data Logging ###################################################
 
tune = 143050000
set_freq = 10000000
 
try:
while True:
now = datetime.datetime.now()
if (now.second == 15) or (now.second == 35) or (now.second == 55):
frequency = fcount.get_freq()
f = open('/sys/bus/i2c/devices/7-0055/frequency', 'a', buffering = 0)
# set_freq = set_freq + (tune - frequency)
 
if (tune > frequency):
set_freq = set_freq + 1
else: set_freq = set_freq - 1
f.write(str(int(set_freq)))
sys.stdout.write("frequency:" + str(frequency) + "\r\n")
f.close()
 
sys.stdout.write("Time:" + str(now.second) + "\r\n")
sys.stdout.flush()
time.sleep(1)
except KeyboardInterrupt:
sys.exit(0)
Property changes:
Added: svn:executable
+*
\ No newline at end of property