Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: jy901 SerialStream 03_JY901_practice
main.cpp@0:73712a48e06d, 2019-10-25 (annotated)
- Committer:
- piroro4560
- Date:
- Fri Oct 25 09:36:43 2019 +0000
- Revision:
- 0:73712a48e06d
- Child:
- 1:fc04d6a786b0
jy901
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 | |
| piroro4560 | 0:73712a48e06d | 4 | JY901 jy(D5, D7); //sda, scl |
| piroro4560 | 0:73712a48e06d | 5 | Serial pc(USBTX, USBRX); |
| 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 | } |