2017_Bteam_gamma
Revision 0:43b500759963, committed 2017-08-17
- Comitter:
- Komazawa_sun
- Date:
- Thu Aug 17 04:48:57 2017 +0000
- Commit message:
- for_gamma_arms
Changed in this revision
johanshin_arm.cpp | Show annotated file Show diff for this revision Revisions of this file |
johanshin_arm.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 43b500759963 johanshin_arm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/johanshin_arm.cpp Thu Aug 17 04:48:57 2017 +0000 @@ -0,0 +1,33 @@ +#include "johanshin_arm.h" + +JohanshinArm::JohanshinArm(int *arm1,int *arm2) +{ + Timeout second_phase; + first_arm = arm1; + second_arm = arm2; +}/* +JohanshinArm::JohanshinArm(int *arm1) +{ + //Timeout second_phase; + first_arm = arm1; + second_arm = NULL; +}*/ + +void JohanshinArm::second_phase_moving(){ + *second_arm = 1; +} + +void JohanshinArm::move_arm(float moving_wait,bool mode) +{ + if(mode == true) + { + *first_arm = 1; + second_phase.attach(this,&JohanshinArm::second_phase_moving,moving_wait); + } + else + { + second_phase.detach(); + *first_arm = 0; + *second_arm = 0; + } +} \ No newline at end of file
diff -r 000000000000 -r 43b500759963 johanshin_arm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/johanshin_arm.h Thu Aug 17 04:48:57 2017 +0000 @@ -0,0 +1,19 @@ +#ifndef JOHANSHIN_ARM_H_ +#define JOHANSHIN_ARM_H_ + +#include "mbed.h" + +class JohanshinArm +{ + public: + JohanshinArm(int *arm1,int *arm2); + //JohanshinArm(unsigned int *arm1); + void move_arm(float movig_wait,bool mode); + private: + Timeout second_phase; + void second_phase_moving(); + int *first_arm; + int *second_arm; +}; + +#endif \ No newline at end of file