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.
Dependencies: QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo
Fork of 17robo_fuzi by
cylinder_.h
00001 /* 00002 ★サイクリック★ 00003 サイクリックでピンをHigh/Lowするクラスです。 00004 ①定義方法 00005 Cyclic_IO [name]( pin ); 00006 | 00007 +--サイクリックでHigh/LowさせたいDigitalOutピン 00008 00009 ②関数 00010 その1 00011 void cyclic(int state) : ピンをサイクリックでHigh/Lowさせる関数。 00012 | 00013 +-- ボタンの入力状況を1 or 0で入れてください。 00014 DigitalInのRead()を入れると一発で動きます。 00015 00016 その2 00017 int getState() : ピンの出力状況を1 or 0で返す関数。 00018 出力されてたら1、されてなかったら0を返します 00019 */ 00020 00021 #ifndef CYLINDER_H 00022 #define CYLINDER_H 00023 00024 #include "mbed.h" 00025 00026 class Cylinder 00027 { 00028 public: 00029 Cylinder(PinName pin_in,PinName pin_out):cylinder_in(pin_in),cylinder_out(pin_out){ 00030 cylinder_in = 1; 00031 cylinder_out = 0; 00032 } 00033 00034 void cyclic(int state) 00035 { 00036 if(state) 00037 { 00038 if(flag == false) 00039 { 00040 cylinder_in = !cylinder_in; 00041 cylinder_out = !cylinder_out; 00042 } 00043 flag = true; 00044 } 00045 else flag = false; 00046 } 00047 00048 int getInState() 00049 { 00050 return (int)cylinder_in; 00051 } 00052 00053 int getOutState() 00054 { 00055 return (int)cylinder_out; 00056 } 00057 00058 private: 00059 DigitalOut cylinder_in; 00060 DigitalOut cylinder_out; 00061 bool flag; 00062 }; 00063 00064 #endif
Generated on Mon Aug 8 2022 20:27:09 by
