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.
Fork of MyLib by
Nunchuck.h
00001 #ifndef NUNCHUCK_H 00002 #define NUNCHUCK_H 00003 00004 00005 #include "mbed.h" 00006 00007 #define NUNCHUCK_ANALOGDATA 1 //1 : analog 0 : degital 00008 #define NUNCHUCK_DEADZONE 0 //analog stick's deadzone 00009 #define NUNCHUCK_ADDR 0xA4 // 0x52 << 1 00010 00011 #define PI 3.14159265358979 00012 00013 class Nunchuck : I2C 00014 { 00015 public: 00016 00017 Nunchuck(PinName SDA, PinName SCL); 00018 int8_t analogx(); 00019 int8_t analogy(); 00020 double analograd(); 00021 double analogdeg(); 00022 double analogrange(); 00023 int8_t accx(); 00024 int8_t accy(); 00025 int8_t accz(); 00026 bool buttonc(); 00027 bool buttonz(); 00028 void getdata(); 00029 00030 private: 00031 Timer timer; 00032 bool flag; 00033 bool init(); 00034 char data[6]; 00035 }; 00036 00037 #endif
Generated on Sun Jul 17 2022 14:24:18 by
1.7.2
