![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test gyroscope L3GD20H - programme à tester
Dependencies: mbed C12832_lcd L3GD20H
main.cpp@0:a385e7f763f9, 2022-03-07 (annotated)
- Committer:
- LouisReynier
- Date:
- Mon Mar 07 17:55:16 2022 +0000
- Revision:
- 0:a385e7f763f9
Test capteur L3GD20
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
LouisReynier | 0:a385e7f763f9 | 1 | #include "mbed.h" |
LouisReynier | 0:a385e7f763f9 | 2 | #include "L3GD20H.h" |
LouisReynier | 0:a385e7f763f9 | 3 | #include "C12832_lcd.h" |
LouisReynier | 0:a385e7f763f9 | 4 | |
LouisReynier | 0:a385e7f763f9 | 5 | // Test Capteur L3GD20H |
LouisReynier | 0:a385e7f763f9 | 6 | // application board mbed |
LouisReynier | 0:a385e7f763f9 | 7 | // affichage des vitesse angulaires |
LouisReynier | 0:a385e7f763f9 | 8 | // short = int 16 bit -32768..32767 |
LouisReynier | 0:a385e7f763f9 | 9 | // scl:p27 et sda:p28 |
LouisReynier | 0:a385e7f763f9 | 10 | // programme à tester |
LouisReynier | 0:a385e7f763f9 | 11 | |
LouisReynier | 0:a385e7f763f9 | 12 | |
LouisReynier | 0:a385e7f763f9 | 13 | DigitalOut myled(LED1); |
LouisReynier | 0:a385e7f763f9 | 14 | L3GD20H gyro(p28, p27); |
LouisReynier | 0:a385e7f763f9 | 15 | C12832_LCD lcd; |
LouisReynier | 0:a385e7f763f9 | 16 | |
LouisReynier | 0:a385e7f763f9 | 17 | short g[3]; // tableau de 3 shorts |
LouisReynier | 0:a385e7f763f9 | 18 | |
LouisReynier | 0:a385e7f763f9 | 19 | int main() { |
LouisReynier | 0:a385e7f763f9 | 20 | while(1) { |
LouisReynier | 0:a385e7f763f9 | 21 | gyro.read(g); // lecture des 3 valeurs |
LouisReynier | 0:a385e7f763f9 | 22 | lcd.locate(0,0); // Set Location print a text |
LouisReynier | 0:a385e7f763f9 | 23 | lcd.printf("Vx=%d ",g[0]); |
LouisReynier | 0:a385e7f763f9 | 24 | lcd.locate(0,10); // Set Location print a text |
LouisReynier | 0:a385e7f763f9 | 25 | lcd.printf("Vy=%d ",g[1]); |
LouisReynier | 0:a385e7f763f9 | 26 | lcd.locate(0,20); // Set Location print a text |
LouisReynier | 0:a385e7f763f9 | 27 | lcd.printf("Vz=%d ",g[2]); |
LouisReynier | 0:a385e7f763f9 | 28 | } |
LouisReynier | 0:a385e7f763f9 | 29 | } |