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_Practice1 by
Diff: headerfile_unuse/cylinder_.h
- Revision:
- 66:1664ee92539d
- Parent:
- 15:0fdf483769bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/headerfile_unuse/cylinder_.h Sun Sep 24 05:25:03 2017 +0000
@@ -0,0 +1,64 @@
+/*
+ ★サイクリック★
+サイクリックでピンをHigh/Lowするクラスです。
+①定義方法
+ Cyclic_IO [name]( pin );
+ |
+ +--サイクリックでHigh/LowさせたいDigitalOutピン
+
+②関数
+ その1
+ void cyclic(int state) : ピンをサイクリックでHigh/Lowさせる関数。
+ |
+ +-- ボタンの入力状況を1 or 0で入れてください。
+ DigitalInのRead()を入れると一発で動きます。
+
+ その2
+ int getState() : ピンの出力状況を1 or 0で返す関数。
+ 出力されてたら1、されてなかったら0を返します
+*/
+
+#ifndef CYLINDER_H
+#define CYLINDER_H
+
+#include "mbed.h"
+
+class Cylinder
+{
+ public:
+ Cylinder(PinName pin_in,PinName pin_out):cylinder_in(pin_in),cylinder_out(pin_out){
+ cylinder_in = 1;
+ cylinder_out = 0;
+ }
+
+ void cyclic(int state)
+ {
+ if(state)
+ {
+ if(flag == false)
+ {
+ cylinder_in = !cylinder_in;
+ cylinder_out = !cylinder_out;
+ }
+ flag = true;
+ }
+ else flag = false;
+ }
+
+ int getInState()
+ {
+ return (int)cylinder_in;
+ }
+
+ int getOutState()
+ {
+ return (int)cylinder_out;
+ }
+
+ private:
+ DigitalOut cylinder_in;
+ DigitalOut cylinder_out;
+ bool flag;
+};
+
+#endif
\ No newline at end of file
