I am working on a audio sensor which detect the frequency or db if you called it. Now that my python program is able to detect the 'db', but I want to use the output and sent it to my web page HTML.
I am using raspberry pi to do that, and also my web server is being hosted by the raspberry pi as well. So basically, the raspberry pi does 2 things, Host webpage & detect the frequency level.
I do not have any idea how to pass those value to HTML.
The follow code is my Python code that I got from online:
import RPi.GPIO as GPIO, time, os
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
def RCtime(Pipin):
measurement = 0
GPIO.setup(Pipin, GPIO.OUT)
GPIO.output(Pipin, GPIO.LOW)
time.sleep(0.1)
GPIO.setup(Pipin, GPIO.IN)
while(GPIO.input(Pipin) == GPIO.HIGH):
measurement = measurement + 1
frequency = (measurement *3.3)/1024
return frequency
while True:
frequency = RCtime(18)
print 'The frequency reading is ', frequency
time.sleep(0.2)
From my knowledge, I am making a guess that I maybe able to use the output value from the following statment to pass it to my HTML webpage.print 'The frequency reading is ', frequency