mylib

Dependents:   robocon2017mbed_control_R

Fork of MyLib by gaku takasawa

Revision:
12:9b31ab2a6ce2
Parent:
11:943d7e603d0f
Child:
13:b375df74762c
diff -r 943d7e603d0f -r 9b31ab2a6ce2 Nunchuck/Nunchuck.h
--- a/Nunchuck/Nunchuck.h	Fri Oct 13 23:00:44 2017 +0000
+++ b/Nunchuck/Nunchuck.h	Tue Oct 24 15:36:42 2017 +0000
@@ -25,13 +25,28 @@
         int accz ();
         bool buttonc();
         bool buttonz();
-    
+        bool init();
+        void offset_(){
+            offsetX = 0;
+            offsetY = 0;
+            offset = false;
+            wait(0.2);
+            //for(int i = 0;i<20;i++){
+                offsetX = (char)analogx();
+                offsetY = (char)analogy();
+            //}
+            offset = true;
+            //offsetX= offsetX/20;
+            //offsetY= offsetY/20;
+        }
+        void getdata();
     private:
         Timer timer;
         bool flag;
-        bool init();
         char data[6];
-        void getdata();
+        int offsetX;
+        int offsetY;
+        bool offset;
 };
 
 #endif
\ No newline at end of file