Python wrapper to communicate with PX4Flow Smart Camera via SMBus. The code was designed to run on Python 2.7 on the Raspberry Pi 3. You'll need to enable I2C communication on the Pi and install python-i2c and python-smbus. Then include the following:
import smbus
import PX4Flow_I2C as px4f
A class to hold I2C frame data from PX4Flow. You must first create a sensor instance:
#Create sensor instance
bus = smbus.SMBus(1) # This will be 1 or 2
address = 0x42 # 7 Bit I2C Address of the Flow Module
px4flow = px4f.PX4Flow_I2C(bus, address)
You then ping the hardware to update one of two data frames:
#I2C frame values
px4flow.update()
#Integral I2C frame values
px4flow.integral_update()
Then you can call on any of the values.
Run the test to continuously print selected values from the I2C frame. Press 'ctrl + c' to quit.