![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test gyroscope L3GD20H - programme à tester
Dependencies: mbed C12832_lcd L3GD20H
Diff: main.cpp
- Revision:
- 0:a385e7f763f9
diff -r 000000000000 -r a385e7f763f9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 07 17:55:16 2022 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" +#include "L3GD20H.h" +#include "C12832_lcd.h" + +// Test Capteur L3GD20H +// application board mbed +// affichage des vitesse angulaires +// short = int 16 bit -32768..32767 +// scl:p27 et sda:p28 +// programme à tester + + +DigitalOut myled(LED1); +L3GD20H gyro(p28, p27); +C12832_LCD lcd; + +short g[3]; // tableau de 3 shorts + +int main() { + while(1) { + gyro.read(g); // lecture des 3 valeurs + lcd.locate(0,0); // Set Location print a text + lcd.printf("Vx=%d ",g[0]); + lcd.locate(0,10); // Set Location print a text + lcd.printf("Vy=%d ",g[1]); + lcd.locate(0,20); // Set Location print a text + lcd.printf("Vz=%d ",g[2]); + } +}