![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
reads gyroscope values
main.cpp@0:637603e82d47, 2015-09-18 (annotated)
- Committer:
- mitchelljones
- Date:
- Fri Sep 18 16:08:39 2015 +0000
- Revision:
- 0:637603e82d47
revision 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mitchelljones | 0:637603e82d47 | 1 | #include "mbed.h" |
mitchelljones | 0:637603e82d47 | 2 | #include "L3GD20.h" |
mitchelljones | 0:637603e82d47 | 3 | |
mitchelljones | 0:637603e82d47 | 4 | Serial pc(USBTX, USBRX); |
mitchelljones | 0:637603e82d47 | 5 | L3GD20 gyro(p28, p27); |
mitchelljones | 0:637603e82d47 | 6 | float gx; |
mitchelljones | 0:637603e82d47 | 7 | float gy; |
mitchelljones | 0:637603e82d47 | 8 | float gz; |
mitchelljones | 0:637603e82d47 | 9 | int x; |
mitchelljones | 0:637603e82d47 | 10 | |
mitchelljones | 0:637603e82d47 | 11 | int main() |
mitchelljones | 0:637603e82d47 | 12 | { |
mitchelljones | 0:637603e82d47 | 13 | |
mitchelljones | 0:637603e82d47 | 14 | while(1) { |
mitchelljones | 0:637603e82d47 | 15 | gyro.read(&gx,&gy,&gz); |
mitchelljones | 0:637603e82d47 | 16 | x = (int)gx*1000; |
mitchelljones | 0:637603e82d47 | 17 | pc.printf("%d",x); |
mitchelljones | 0:637603e82d47 | 18 | |
mitchelljones | 0:637603e82d47 | 19 | wait(0.01); |
mitchelljones | 0:637603e82d47 | 20 | |
mitchelljones | 0:637603e82d47 | 21 | |
mitchelljones | 0:637603e82d47 | 22 | } |
mitchelljones | 0:637603e82d47 | 23 | |
mitchelljones | 0:637603e82d47 | 24 | } |