I'm using the TSL235 (http://www.ti.com/lit/ds/symlink/tsl235.pdf) light-to-frequency converter and the Raspberry Pi. The output of the sensor is a square wave (50% duty cycle) with frequency directly proportional to light intensity.
So I need to know (in a python script) which frequency gets to the Input GPIO-Pin of the Raspberry Pi.
I only found a tutorial (http://playground.arduino.cc/Main/TSL235R) which shows a C-code, but I do not understand C... I'm only working with python
Reading a GPIO Input isn't that hard so far:
#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.IN)
impuls_count = 0
# Do next lines for i.e. 1000ms:
GPIO.wait_for_edge(25, GPIO.FALLING)
impuls_count = impuls_count + 1
I think I have to count the signals in a time intervall. But how?