Yosuke Kirihata / Mbed 2 deprecated Nucleo_CaitSith_Firmware_added_delayServo

Dependencies:   mbed

Fork of Nucleo_CaitSith_Firmware by Yosuke Kirihata

Revision:
4:039a7d1ce3e9
Parent:
3:9ac9fdf1856e
Child:
6:a3829299dfd5
--- a/DelayServo.cpp	Sat Nov 08 02:45:59 2014 +0000
+++ b/DelayServo.cpp	Sat Jan 24 17:41:21 2015 +0000
@@ -1,5 +1,6 @@
 #include <mbed.h>
 #include <DelayServo.h>
+#include <def_resources.h>
 
 /**
  * 遅延サーボクラス
@@ -14,7 +15,7 @@
 ,mCurrentAngle(0)
 ,mInterval(DEFAULT_INTERVAL)
 {
-  mTick.attach_us(this, &DelayServo::moveServo, mInterval);
+  //mTick.attach_us(this, &DelayServo::moveServo, mInterval);
 };
 
 /**
@@ -26,7 +27,7 @@
 ,mCurrentAngle(0)
 ,mInterval(DEFAULT_INTERVAL)
 {
-  mTick.attach_us(this, &DelayServo::moveServo, mInterval);
+  //mTick.attach_us(this, &DelayServo::moveServo, mInterval);
 };
 
 /**
@@ -38,7 +39,7 @@
 ,mCurrentAngle(0)
 ,mInterval(interval)
 {
-  mTick.attach_us(this, &DelayServo::moveServo, mInterval);
+  //mTick.attach_us(this, &DelayServo::moveServo, mInterval);
 };
 
 /**
@@ -52,14 +53,14 @@
 ,mCurrentAngle(0)
 ,mInterval(interval)
 {
-  mTick.attach_us(this, &DelayServo::moveServo, mInterval);
+  //mTick.attach_us(this, &DelayServo::moveServo, mInterval);
 };
 
 /**
  * デストラクタ
  */
 DelayServo::~DelayServo() {
-  mTick.detach();
+  //mTick.detach();
 }
 
 /**
@@ -67,6 +68,8 @@
  */
 void DelayServo::moveServo(void)
 {
+  nyandaLight = 1 - nyandaLight;
+  
   //角度計算
   if (mTargetAngle - mCurrentAngle >= 0) {//順方向
     if (mTargetAngle - mCurrentAngle > mStepAngle) {//目標角度-現在角度が上限角度を超えるなら現在値を上限角度分移動
@@ -90,9 +93,9 @@
  */
 void DelayServo::updateInterval(int interval)
 {
-  mTick.detach();
+  //mTick.detach();
   mInterval = interval;
-  mTick.attach_us(this, &DelayServo::moveServo, mInterval);
+  //mTick.attach_us(this, &DelayServo::moveServo, mInterval);
 }
 
 /**