jy901の確認用プログラム わからなければ安澤が何とかします
Dependencies: jy901 SerialStream 03_JY901_practice
main.cpp@1:fc04d6a786b0, 2020-01-27 (annotated)
- Committer:
- THtakahiro702286
- Date:
- Mon Jan 27 09:07:08 2020 +0000
- Revision:
- 1:fc04d6a786b0
- Parent:
- 0:73712a48e06d
- Child:
- 5:85564a8445f9
jy901 practice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
piroro4560 | 0:73712a48e06d | 1 | #include "mbed.h" |
piroro4560 | 0:73712a48e06d | 2 | #include "jy901.h" |
piroro4560 | 0:73712a48e06d | 3 | |
THtakahiro702286 | 1:fc04d6a786b0 | 4 | JY901 jy(PB_4, PA_8); //sda, scl |
THtakahiro702286 | 1:fc04d6a786b0 | 5 | Serial pc(USBTX, USBRX, 115200); |
piroro4560 | 0:73712a48e06d | 6 | |
piroro4560 | 0:73712a48e06d | 7 | int main() { |
piroro4560 | 0:73712a48e06d | 8 | float x, y, z; |
piroro4560 | 0:73712a48e06d | 9 | jy.calibrateAll(50); |
piroro4560 | 0:73712a48e06d | 10 | while(1) { |
piroro4560 | 0:73712a48e06d | 11 | x = jy.getXaxisAngle(); |
piroro4560 | 0:73712a48e06d | 12 | y = jy.getYaxisAngle(); |
piroro4560 | 0:73712a48e06d | 13 | z = jy.getZaxisAngle(); |
piroro4560 | 0:73712a48e06d | 14 | pc.printf("x:%f | y:%f | z:%f\r\n", x, y, z); |
piroro4560 | 0:73712a48e06d | 15 | } |
piroro4560 | 0:73712a48e06d | 16 | } |