#!/usr/bin/env python """ Tool to assist debugging rfm2pi issues. Used to confirm life and retrieve current configuration """ __author__ = 'Paul Burnell (pb66)' __date__ = '09-02-2016' # http://openenergymonitor.org/emon/node/12004 # Set the correct serial port and baud for the device # Probally '/dev/ttyAMA0' and 9600, 38400, 57600 or 115200 com_port='/dev/ttyAMA0' com_baud=38400 import serial try: ser = serial.Serial(com_port, com_baud) print "Use CRTL-C to exit" ser.write('v') except: print "Unable to access serial port - Exiting" exit try: while 1: serial_line = ser.readline() print(serial_line), except KeyboardInterrupt: print exit