Test Code for VL53L0x/PMW3901 Sensor

Dependencies:   mbed CrazyflieSensors

Files at this revision

API Documentation at this revision

Comitter:
osaka
Date:
Mon Feb 14 08:53:49 2022 +0000
Commit message:
test code

Changed in this revision

CrazyflieSensors.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 32868d4b0196 CrazyflieSensors.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CrazyflieSensors.lib	Mon Feb 14 08:53:49 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/fbob/code/CrazyflieSensors/#e07de535b86f
diff -r 000000000000 -r 32868d4b0196 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 14 08:53:49 2022 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+#include "PMW3901.h"
+#include "VL53L0X.h"
+ 
+Serial pc(USBTX, USBRX); // tx, rx
+//SPI spi(PB_5, PB_4, PB_3); // mosi, miso, sclk
+//DigitalOut cs(PA_4); 
+ 
+int main()
+{
+    pc.baud(38400);
+    
+    PMW3901 pmw(PB_5, PB_4, PB_3, PA_4);
+    VL53L0X vl(PB_9, PB_8);
+    
+    int init_pmw =  pmw.init();
+    int init_vl = vl.init();
+    
+    pc.printf("initialize pmw: %d\r\n", init_pmw);
+    pc.printf("initialize vl: %d\r\n", init_vl);
+    
+    while (true)
+    {
+        pmw.read();
+        vl.read();
+        
+        pc.printf("%f %f %f\r\n", pmw.px, pmw.py, vl.d);
+        
+        wait(0.01);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 32868d4b0196 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 14 08:53:49 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file