I'm working on a tiny project to learn how to show real-time data from a analog source on a display connected to the Raspberry through HDMI.
This is what I've planned; I've written some code, which now displays the irradiance directly on the screen... it works perfect.... but it's plain text, not very nice looking
Code: Select all
#!/usr/bin/python import time, signal, sys from Adafruit_ADS1x15 import ADS1x15 def signal_handler(signal, frame): #print 'You pressed Ctrl+C!' sys.exit(0) signal.signal(signal.SIGINT, signal_handler) #print 'Press Ctrl+C to exit' ADS1015 = 0x00 # 12-bit ADC ADS1115 = 0x01 # 16-bit ADC # Initialise the ADC using the default mode (use default I2C address) # Set this to ADS1015 or ADS1115 depending on the ADC you are using! adc = ADS1x15(ic=ADS1015) print("\033c"); output = " " while True: # Now do a differential reading of channels 2 and 3 voltsdiff = adc.readADCDifferential23(256, 8) solar = (voltsdiff/70)*1000 # Display the solar irridiation print '\r%.1f' % (solar), sys.stdout.flush()
Would it be easier to read the data real time in a HTML document and show it in a web browser?
The Raspberry should show this screen after power-up... automatically.