I am running an apache web server on my raspberry pi B+ on my home network. My data plan only allows me a certain amount of data a month before they throttle it to almost unusable. I want to set up a python code that can monitor the data usage and activate a LED connected to one of the Pi's GPIO pins when the usage is too high.
I can do the GPIO stuff in python but if there is another better or easier way of doing it i am open to it.
I am currently using the RPi.GPIO library to control the GPIO pins so if possible it would be helpful if i can stick to this.
This is some code i use to update the file on the web server:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT) #Red LED
GPIO.setup(13, GPIO.OUT) #Green LED
try:
#do stuff that might throw an error
GPIO.output(11, False)
GPIO.output(13, True)
except:
GPIO.output(11, True)
GPIO.output(13, False)