Library containing Crazyflie 2.0 sensors drivers: - LPS25H (barometer) - MPU9250 (IMU) - PMW3901 (optical flow) - VL53L0X (range)
Dependents: Drones-Controlador controladoatitude_cteste Drone_Controlador_Atitude optical_test
PMW3901 Class Reference
PMW3901 (optical flow sensor) class. More...
#include <PMW3901.h>
Public Member Functions | |
PMW3901 (PinName mosi, PinName miso, PinName sclk, PinName csel) | |
Class constructor. | |
bool | init () |
Initialize optical flow. | |
Data Fields | |
float | px |
Optical flow data in x-axis (px) | |
float | py |
Optical flow data in y-axis (px) |
Detailed Description
PMW3901 (optical flow sensor) class.
Example code (print optical flow data on serial port every 0.2 second):
#include "mbed.h" #include "USBSerial.h" #include "PMW3901.h" USBSerial pc; PMW3901 flow(PA_7,PA_6,PA_5,PB_4); int main() { flow.init(); while(1) { flow.read(); pc.printf("Optical flow [px]: %6.2f %6.2f \n\n", flow.x, flow.y); wait(0.2); } }
(Need to target to NUCLEO-F401RE board platform)
Definition at line 40 of file PMW3901.h.
Constructor & Destructor Documentation
PMW3901 | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk, | ||
PinName | csel | ||
) |
Class constructor.
Definition at line 4 of file PMW3901.cpp.
Member Function Documentation
bool init | ( | ) |
Initialize optical flow.
Definition at line 9 of file PMW3901.cpp.
Field Documentation
Generated on Wed Jul 13 2022 13:25:49 by 1.7.2