Project

General

Profile

« Previous | Next » 

Revision 6ec4a106

Added by dsorber about 13 years ago

Made a few minor changes to the RPi client.

View differences:

525.743/code/rpi_client.py
THRESHOLD_TEMP = 82
HOST = '192.168.1.2'
HOST = '192.168.1.1'
PORT = 2243
REMOTE_DATA_INTERVAL = 20 # in seconds
REMOTE_DATA_INTERVAL = 1 # in seconds
def button_isr(gpio_id, val):
global CURRENT_IDX
......
global CURRENT_IDX
global SENSORS
# Make sure the script is being run as root before continuing
if os.geteuid() != 0:
print 'ERROR: You must run the client as root!'
return
# Disable "channel already in use" warnings
RPIO.setwarnings(False)
......
if sys.argv[1] == '-d':
DEBUG = True
# Make sure the script is being run as root before continuing
if os.geteuid() != 0:
print 'ERROR: You must run the client as root!'
return
# Attempt to connect to the server, make 5 attempts
print '\n\nAttempting to connect to server...',
sys.stdout.flush()
......
if interval_counter == REMOTE_DATA_INTERVAL:
interval_counter = 0
interval_counter += 1
# Grab the current date/time
now = datetime.datetime.now()
......
if DEBUG:
print 'ERROR'
interval_counter += 1
# Read once every second (approximated to account for processing
# latencies)
time.sleep(0.9)

Also available in: Unified diff