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.
Dependents: robocon2017mbed_contoroler_L2
Fork of MyLib by
Nunchuck/Nunchuck.h@11:08d8bd103eda, 2017-10-13 (annotated)
- Committer:
- kikoaac
- Date:
- Fri Oct 13 09:35:30 2017 +0000
- Revision:
- 11:08d8bd103eda
- Parent:
- 7:15e3890a6782
- Child:
- 12:479a1f294781
testes
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| gaku_sigu | 0:a919993ff50f | 1 | #ifndef NUNCHUCK_H |
| gaku_sigu | 0:a919993ff50f | 2 | #define NUNCHUCK_H |
| gaku_sigu | 0:a919993ff50f | 3 | |
| gaku_sigu | 0:a919993ff50f | 4 | |
| gaku_sigu | 0:a919993ff50f | 5 | #include "mbed.h" |
| gaku_sigu | 0:a919993ff50f | 6 | |
| gaku_sigu | 3:e7a900958f54 | 7 | #define NUNCHUCK_ANALOGDATA 1 //1 : analog 0 : degital |
| kikoaac | 11:08d8bd103eda | 8 | #define NUNCHUCK_DEADZONE 0 //analog stick's deadzone |
| gaku_sigu | 3:e7a900958f54 | 9 | #define NUNCHUCK_ADDR 0xA4 // 0x52 << 1 |
| gaku_sigu | 0:a919993ff50f | 10 | |
| gaku_sigu | 6:d5b128533dfe | 11 | #define PI 3.14159265358979 |
| gaku_sigu | 6:d5b128533dfe | 12 | |
| gaku_sigu | 0:a919993ff50f | 13 | class Nunchuck : I2C |
| gaku_sigu | 0:a919993ff50f | 14 | { |
| gaku_sigu | 0:a919993ff50f | 15 | public: |
| gaku_sigu | 0:a919993ff50f | 16 | |
| gaku_sigu | 0:a919993ff50f | 17 | Nunchuck(PinName SDA, PinName SCL); |
| gaku_sigu | 0:a919993ff50f | 18 | int8_t analogx(); |
| gaku_sigu | 0:a919993ff50f | 19 | int8_t analogy(); |
| gaku_sigu | 3:e7a900958f54 | 20 | double analograd(); |
| gaku_sigu | 5:69e9c81e9490 | 21 | double analogdeg(); |
| gaku_sigu | 7:15e3890a6782 | 22 | double analogrange(); |
| gaku_sigu | 0:a919993ff50f | 23 | int accx(); |
| gaku_sigu | 0:a919993ff50f | 24 | int accy(); |
| gaku_sigu | 0:a919993ff50f | 25 | int accz (); |
| gaku_sigu | 0:a919993ff50f | 26 | bool buttonc(); |
| gaku_sigu | 0:a919993ff50f | 27 | bool buttonz(); |
| kikoaac | 11:08d8bd103eda | 28 | bool init(); |
| kikoaac | 11:08d8bd103eda | 29 | |
| gaku_sigu | 0:a919993ff50f | 30 | private: |
| gaku_sigu | 0:a919993ff50f | 31 | Timer timer; |
| gaku_sigu | 0:a919993ff50f | 32 | bool flag; |
| gaku_sigu | 0:a919993ff50f | 33 | char data[6]; |
| gaku_sigu | 0:a919993ff50f | 34 | void getdata(); |
| gaku_sigu | 0:a919993ff50f | 35 | }; |
| gaku_sigu | 0:a919993ff50f | 36 | |
| gaku_sigu | 0:a919993ff50f | 37 | #endif |
