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 Nucleo_CaitSith_Firmware by
Diff: DelayServo.cpp
- Revision:
- 4:039a7d1ce3e9
- Parent:
- 3:9ac9fdf1856e
- Child:
- 6:a3829299dfd5
diff -r 9ac9fdf1856e -r 039a7d1ce3e9 DelayServo.cpp
--- 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);
}
/**
