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.
kyuuban.cpp
00001 #if 1 00002 #include "kyuuban.h" 00003 #include "QEI.h" 00004 00005 Timer enc_tim; //Timerクラスのインスタンス(実体) 00006 QEI qei(D15,D14,D10,800,&enc_tim); //class宣言 00007 // qei.getPulses(); //Pulsesを返す 00008 00009 void KyuubanINIT() { 00010 // pc.printf("morter init ... "); 00011 kyuuban_pwm.period_us(100); //PWM信号を出し始める 00012 kyuuban_pwm.pulsewidth_ms(20); 00013 kyuuban_up = 0; //正転も逆転もしない状態 00014 kyuuban_down = 0; 00015 kyuuban_dis = 0; //dis=1だとフリー回転 00016 kyuubanMOVE = 0; 00017 int K1 = kyuuban_lim; 00018 while(K1 == 0){ //反応してる状態が0? 00019 kyuuban_down = 1; //下降開始 00020 K1 = kyuuban_lim; //代入しなおし 00021 wait_ms(0.5); 00022 } 00023 kyuuban_down = 0; //下降停止 00024 // pc.printf("END\n\r"); 00025 // return 0; 00026 } 00027 00028 void KyuubanLIFT(){ 00029 // pc.printf("Lyuuban LIFT..."); 00030 kyuuban_up = 1; 00031 while(qei.getPulses() < kyuubanUPlimit){ 00032 wait_ms(0.5); 00033 } 00034 kyuuban_up = 0; 00035 // return 0; 00036 } 00037 00038 void KyuubanEND(){ 00039 kyuuban_down = 1; 00040 while(qei.getPulses() < kyuubanDOWN){ 00041 wait_ms(0.5); 00042 } 00043 kyuuban_down = 0; 00044 kyuubanMOVE = 0; 00045 wait(2); 00046 // return 0; 00047 } 00048 00049 00050 #endif
Generated on Wed Jul 13 2022 04:06:48 by
1.7.2