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: mbed AQM1602 HMC6352 PID
def.h
00001 #ifndef _DEF_H_ 00002 #define _DEF_H_ 00003 00004 //BT(BlueTooth) 00005 #define DATA_NUM 8+2//2byte→KEYCODE(拝啓)とCHECKCODE(敬具) 8byte→やりとりするデータ 00006 #define TX_KEYCODE 0xAA//あちらのKEYCODE 00007 #define RX_KEYCODE 0xAA//こちらのKEYCODE 00008 #define KEY 0//KEYCODEは配列の最初 00009 #define CHECK DATA_NUM-1//CHECKCODEは配列の最後 00010 00011 00012 //Switch 入力値 00013 #define NONE 0 00014 #define UP 1 00015 #define DOWN 2 00016 #define RIGHT 3 00017 #define LEFT 4 00018 00019 //Lcd 設定値 00020 #define BUFSIZE 10 00021 #define STATE_NUM_X 0x04 00022 #define STATE_NUM_Y 0x10 00023 //繰り返し割り込み 00024 #define DUTY_NUM 1 00025 00026 #define DUTY_SW 0 00027 #define DUTY_GYRO 1 00028 #define DUTY_PING 2 00029 #define DUTY_COLOR 3 00030 #define DUTY_MOUSE 4 00031 00032 /*PID処理*/ 00033 #define RATE 0.052//52 00034 #define PID_BIAS 1.0 00035 #define REFERENCE 180.0 00036 #define MINIMUM 0.0 00037 #define MAXIMUM 359.9 00038 #define P_GAIN 1.3//1.25//0.8 //0.78 00039 #define I_GAIN 0.0 //0.0 00040 #define D_GAIN 0.01//0.01 //0.009 00041 #define OUT_LIMIT 30.0 00042 #define MAX_POW 100 00043 #define MIN_POW -100 00044 #define PID_CYCLE 0.05 //s 00045 00046 //ir 00047 #define IR_X 0 00048 #define IR_Y 1 00049 #define IR_SHORT 0 00050 #define IR_LONG 1 00051 00052 #define X_AXIS 0 00053 #define Y_AXIS 1 00054 00055 //ping 00056 #define L_PING 0 00057 #define R_PING 1 00058 00059 //line 00060 00061 #define A_SPOT 0 00062 #define B_SPOT 1 00063 #define C_SPOT 2 00064 #define AB_SPOT 3 00065 00066 #define LINE_RF 5 00067 #define LINE_DELAY 0.5 00068 #define RELEASE_VAL 150 00069 00070 //思考パターン 00071 #define STRATEGY_NUM 12 00072 00073 //計算 00074 #define ROUND(x) ((x > 0) ? (x + 0.5) : (x - 0.5))//x...整数 00075 #define PI 3.14159265358979323846 00076 #define DEG2RAD(deg) (PI*(deg)/180.0) 00077 #define RAD2DEG(rad) (180.0(rad)/PI) 00078 00079 //データ 00080 typedef struct {//ir,line,gyro,mouse,ping 00081 //ping 00082 uint8_t ping[2]; 00083 //ir 00084 uint8_t irKey; 00085 uint8_t irNotice; 00086 uint8_t irSpot[2]; 00087 uint8_t irPosition; 00088 uint8_t IrFlag; 00089 //line 00090 uint8_t lnFlag[3]; 00091 uint8_t ball; 00092 uint8_t KickOffFlag; 00093 //uint8_t LineBind[4];//宣言すると動かない⇒構造体の限界 00094 uint8_t KickFlag; 00095 int32_t mouse[2];//0...x,1...y//1cm nearlyeq 1000count 00096 //motor 00097 int32_t motorlog[2]; 00098 uint8_t MotorFlag; 00099 double s_pow; 00100 double l_pow; 00101 //cmps&pid 00102 uint8_t PidFlag; 00103 double cmps, CmpsInitialValue, CmpsDiff, FrontDeg;//0<x<360 00104 double InputPID;//<<gyrosensor 00105 int16_t OutputPID;//>>motor 00106 //uint8_t color[3]; 00107 //uint8_t lcdpoint[2];//0...x,1...y 00108 uint8_t strategy; 00109 uint8_t init_point_flag; 00110 uint8_t stopflag; 00111 } Record; 00112 00113 #endif
Generated on Tue Jul 12 2022 23:12:38 by
1.7.2