四輪オムニの足回りを動かすプログラム
Embed:
(wiki syntax)
Show/hide line numbers
SBDBT.hpp
00001 #ifndef SBDBT_H 00002 #define SBDBT_H 00003 #include "mbed.h" 00004 00005 //data[1] 00006 #define CIRCLE 0x01 00007 #define L1 0x02 00008 #define L2 0x04 00009 #define R1 0x08 00010 #define R2 0x10 00011 #define START 0x20 00012 #define SELECT 0x40 00013 00014 //data[2] 00015 #define UP 0x01 00016 #define DOWN 0x02 00017 #define LEFT 0x04 00018 #define RIGHT 0x08 00019 #define TRI 0x10 00020 #define CROSS 0x20 00021 #define SQUARE 0x40 00022 00023 /*SBDBTを用いてPS3コントローラ(DS3)を使う 00024 sbdbt sb(A0, A1); マイコン ~ PC間のボーレート指定なし(9600) 00025 sbdbt sb(A0, A1, 115200); マイコン ~ PC間のボーレート指定あり 00026 */ 00027 00028 class sbdbt { 00029 public: 00030 sbdbt(PinName TX, PinName RX); //マイコン ~ PC間のボーレート指定なし(9600) 00031 sbdbt(PinName TX, PinName RX, int baud); //マイコン ~ PC間のボーレート指定あり 00032 void get(void); 00033 void button_state(); //全ボタン, スティックの状態表示 00034 void data_print(); 00035 bool neutral(); 00036 bool up(); 00037 bool down(); 00038 bool left(); 00039 bool right(); 00040 bool tri(); 00041 bool cross(); 00042 bool square(); 00043 bool circle(); 00044 bool l1(); 00045 bool l2(); 00046 bool r1(); 00047 bool r2(); 00048 bool start(); 00049 bool select(); 00050 char lsx(); 00051 char lsy(); 00052 char rsx(); 00053 char rsy(); 00054 char l2An(); 00055 char r2An(); 00056 bool command(); 00057 ~sbdbt(); 00058 private: 00059 Serial *dev; 00060 char *data; 00061 char *PS3_Data; 00062 char i; 00063 char pos; 00064 char val; 00065 char len; 00066 }; 00067 #endif
Generated on Sat Oct 8 2022 11:15:36 by
1.7.2