Modify ota's code

Dependencies:   Dynamixel SerialHalfDuplex mbed

Fork of YOZAKURA_ARM_USB_0425 by 雄介 太田

Committer:
yusuke_kyo
Date:
Sat Apr 25 03:36:16 2015 +0000
Revision:
2:f0efe1d10f8a
Parent:
1:bf4d524625f5
Child:
3:6a932d0aac7d
correct mode

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yusuke_kyo 0:8822acabe470 1 /*YOZAKURAのアームコード
yusuke_kyo 0:8822acabe470 2 シリアル通信で送るデータ S_Data={linearD[4],pitchD[4],yawD[4],ThermoD1[16],ThermoD2[16],CO2[4]} 計48bytes
yusuke_kyo 0:8822acabe470 3 シリアル通信で受け取るデータ R_Data={mode[2bit],linear_ref[2bit],pitch_ref[2bit],yaw_ref[2bit]} 計1byte
yusuke_kyo 0:8822acabe470 4 */
yusuke_kyo 0:8822acabe470 5
yusuke_kyo 0:8822acabe470 6 #include "mbed.h"
yusuke_kyo 0:8822acabe470 7
yusuke_kyo 0:8822acabe470 8 Serial pc(USBTX, USBRX); // tx, rx
yusuke_kyo 0:8822acabe470 9 DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4);
yusuke_kyo 0:8822acabe470 10
yusuke_kyo 0:8822acabe470 11 /*--Dynamixel:begin-----------------------------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 12 #include "AX12.h"
yusuke_kyo 0:8822acabe470 13 #include "MX28.h"
yusuke_kyo 0:8822acabe470 14
yusuke_kyo 0:8822acabe470 15 DigitalOut low(p16); DigitalOut RelaySwitch(p18);
yusuke_kyo 0:8822acabe470 16
yusuke_kyo 0:8822acabe470 17 AX12 linear (p13, p14, 0, 1000000); //直動Dynamixel
yusuke_kyo 0:8822acabe470 18 MX28 pitch (p13, p14, 1, 1000000); //ピッチDynamixel
yusuke_kyo 0:8822acabe470 19 MX28 yaw (p13, p14, 2, 1000000); //ヨーDynamixel
yusuke_kyo 0:8822acabe470 20
yusuke_kyo 0:8822acabe470 21 int linear_goal, pitch_goal, yaw_goal;
yusuke_kyo 0:8822acabe470 22
yusuke_kyo 0:8822acabe470 23 //最小値,最大値,角速度,初期値を指定[unit:degree]
yusuke_kyo 0:8822acabe470 24 //MX:MultiTurnモードでは-2520°~2520°(SetGoalの書き換え不要)
yusuke_kyo 0:8822acabe470 25 int linear_min = 100; int linear_MAX = 300; float linear_Speed=0.1; int linear_Init = linear_MAX;
yusuke_kyo 0:8822acabe470 26 int pitch_min = 172; int pitch_MAX = 334; float pitch_Speed=0.2; int pitch_Init = pitch_MAX;
yusuke_kyo 0:8822acabe470 27 int yaw_min = 360; int yaw_MAX = 360; float yaw_Speed=0.2; int yaw_Init = 0; //MultiTurnモード
yusuke_kyo 0:8822acabe470 28
yusuke_kyo 0:8822acabe470 29 void Dyna_init() {
yusuke_kyo 0:8822acabe470 30 // low = 0; RelaySwitch = 1;
yusuke_kyo 0:8822acabe470 31 linear.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 32 pitch.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 33 yaw.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 34 linear.SetCWLimit(linear_min); linear.SetCCWLimit(linear_MAX);
yusuke_kyo 0:8822acabe470 35 linear.SetCRSpeed(linear_Speed); linear_goal=linear_Init;
yusuke_kyo 0:8822acabe470 36 pitch.SetCWLimit(pitch_min); pitch.SetCCWLimit(pitch_MAX);
yusuke_kyo 0:8822acabe470 37 pitch.SetCRSpeed(pitch_Speed); pitch_goal=pitch_Init;
yusuke_kyo 0:8822acabe470 38 yaw.SetCWLimit(yaw_min); yaw.SetCCWLimit(yaw_MAX);
yusuke_kyo 0:8822acabe470 39 yaw.SetCRSpeed(yaw_Speed); yaw_goal=yaw_Init;
yusuke_kyo 0:8822acabe470 40 wait(1);
yusuke_kyo 0:8822acabe470 41 }
yusuke_kyo 0:8822acabe470 42
yusuke_kyo 0:8822acabe470 43 void Dyna_GetData(char* data) {
yusuke_kyo 0:8822acabe470 44 float lP, lV, pP, pC, yP, yC;
yusuke_kyo 0:8822acabe470 45
yusuke_kyo 0:8822acabe470 46 lP = linear.GetPosition(); lV = linear.GetVolts();
yusuke_kyo 0:8822acabe470 47 pP = pitch.GetPosition(); pC = pitch.GetCurrent();
yusuke_kyo 0:8822acabe470 48 yP = yaw.GetPosition(); yC = yaw.GetCurrent();
yusuke_kyo 0:8822acabe470 49
yusuke_kyo 0:8822acabe470 50 linear_goal=lP; pitch_goal=pP; yaw_goal=yP; //現在角度を目標値に設定
yusuke_kyo 0:8822acabe470 51 sprintf(data,"%4.1f %4.1f %4.1f %4.1f %4.1f %4.1f ",lP,lV,pP,pC,yP,yC);
yusuke_kyo 0:8822acabe470 52 }
yusuke_kyo 0:8822acabe470 53
yusuke_kyo 0:8822acabe470 54 void Dyna_SetGoal(int linear_mode, int pitch_mode, int yaw_mode) {
yusuke_kyo 0:8822acabe470 55 switch(linear_mode){
yusuke_kyo 0:8822acabe470 56 case 0: break;
yusuke_kyo 0:8822acabe470 57 case 1: linear.SetTorqueLimit(1); linear_goal++; break;
yusuke_kyo 0:8822acabe470 58 case 2: linear.SetTorqueLimit(1); linear_goal--; break;
yusuke_kyo 0:8822acabe470 59 }
yusuke_kyo 0:8822acabe470 60 if(linear_goal>linear_MAX) linear_goal=linear_MAX;
yusuke_kyo 0:8822acabe470 61 if(linear_goal<linear_min) linear_goal=linear_min;
yusuke_kyo 0:8822acabe470 62 linear.SetGoal(linear_goal);
yusuke_kyo 0:8822acabe470 63
yusuke_kyo 0:8822acabe470 64 switch(pitch_mode){
yusuke_kyo 0:8822acabe470 65 case 0: break;
yusuke_kyo 2:f0efe1d10f8a 66 case 1: pitch_goal-=5; break;
yusuke_kyo 2:f0efe1d10f8a 67 case 2: pitch_goal+=5; break;
yusuke_kyo 0:8822acabe470 68 }
yusuke_kyo 0:8822acabe470 69 if(pitch_goal>pitch_MAX) pitch_goal=pitch_MAX;
yusuke_kyo 0:8822acabe470 70 if(pitch_goal<pitch_min) pitch_goal=pitch_min;
yusuke_kyo 0:8822acabe470 71 pitch.SetGoal(pitch_goal);
yusuke_kyo 0:8822acabe470 72
yusuke_kyo 0:8822acabe470 73 switch(yaw_mode){
yusuke_kyo 0:8822acabe470 74 case 0: break;
yusuke_kyo 0:8822acabe470 75 case 1: yaw_goal-=5; break;
yusuke_kyo 0:8822acabe470 76 case 2: yaw_goal+=5; break;
yusuke_kyo 0:8822acabe470 77 }
yusuke_kyo 0:8822acabe470 78 if(pitch_goal>2520) pitch_goal=2520;
yusuke_kyo 0:8822acabe470 79 if(pitch_goal<-2520) pitch_goal=-2520;
yusuke_kyo 0:8822acabe470 80 yaw.SetGoal(yaw_goal);
yusuke_kyo 0:8822acabe470 81 }
yusuke_kyo 0:8822acabe470 82
yusuke_kyo 0:8822acabe470 83 void Dyna_home_position() {
yusuke_kyo 0:8822acabe470 84 linear.SetTorqueLimit(1);
yusuke_kyo 0:8822acabe470 85 pitch.SetTorqueLimit(1);
yusuke_kyo 0:8822acabe470 86 yaw.SetTorqueLimit(1);
yusuke_kyo 0:8822acabe470 87 float lp;
yusuke_kyo 0:8822acabe470 88 linear.SetGoal(linear_Init);
yusuke_kyo 0:8822acabe470 89 lp=linear.GetPosition();
yusuke_kyo 0:8822acabe470 90 if(lp > linear_MAX - 30) { //ある程度縮んだら
yusuke_kyo 0:8822acabe470 91 pitch.SetGoal(pitch_Init);
yusuke_kyo 0:8822acabe470 92 yaw.SetGoal(yaw_Init);
yusuke_kyo 0:8822acabe470 93 }
yusuke_kyo 0:8822acabe470 94 }
yusuke_kyo 0:8822acabe470 95
yusuke_kyo 0:8822acabe470 96 void Dyna_reset() {
yusuke_kyo 0:8822acabe470 97 // RelaySwitch = 0;
yusuke_kyo 0:8822acabe470 98 linear.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 99 pitch.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 100 yaw.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 101
yusuke_kyo 2:f0efe1d10f8a 102 wait(0.1);
yusuke_kyo 0:8822acabe470 103
yusuke_kyo 0:8822acabe470 104 // RelaySwitch = 1;
yusuke_kyo 0:8822acabe470 105 linear.SetTorqueLimit(1);
yusuke_kyo 0:8822acabe470 106 pitch.SetTorqueLimit(1);
yusuke_kyo 0:8822acabe470 107 yaw.SetTorqueLimit(1);
yusuke_kyo 0:8822acabe470 108 }
yusuke_kyo 0:8822acabe470 109
yusuke_kyo 0:8822acabe470 110 void Dyna_end() {
yusuke_kyo 0:8822acabe470 111 // RelaySwitch = 0;
yusuke_kyo 0:8822acabe470 112 linear.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 113 pitch.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 114 yaw.SetTorqueLimit(0);
yusuke_kyo 0:8822acabe470 115 }
yusuke_kyo 0:8822acabe470 116 /*--Dynamixel:end-----------------------------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 117
yusuke_kyo 0:8822acabe470 118
yusuke_kyo 0:8822acabe470 119 /*--Thermal_Sensor:begin----------------------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 120 /*MEMS非接触温度センサ:形D6T-44L-06 4×4素子タイプ*/
yusuke_kyo 0:8822acabe470 121 /*データシート:http://www.omron.co.jp/ecb/products/sensor/special/mems/pdf/AN-D6T-01JP_r2.pdf*/
yusuke_kyo 0:8822acabe470 122
yusuke_kyo 0:8822acabe470 123 I2C MEMS1(p9, p10); // sda, scl
yusuke_kyo 0:8822acabe470 124 I2C MEMS2(p28, p27); // sda, scl
yusuke_kyo 0:8822acabe470 125
yusuke_kyo 0:8822acabe470 126 #define D6T_addr 0x14
yusuke_kyo 0:8822acabe470 127 #define D6T_cmd 0x4c
yusuke_kyo 0:8822acabe470 128
yusuke_kyo 2:f0efe1d10f8a 129 #define THERMO_DEBUG 0
yusuke_kyo 0:8822acabe470 130
yusuke_kyo 0:8822acabe470 131 void GetThermo(char* data) {
yusuke_kyo 0:8822acabe470 132 char con[10];
yusuke_kyo 0:8822acabe470 133
yusuke_kyo 0:8822acabe470 134 /*MEMS1*/
yusuke_kyo 0:8822acabe470 135 char I2C_rd1[64]; // 生データ
yusuke_kyo 0:8822acabe470 136 short datr1[16]; // 16点 温度データ(10倍整数)
yusuke_kyo 0:8822acabe470 137 short PTAT1; // センサ内部PTAT温度データ(10倍整数)
yusuke_kyo 0:8822acabe470 138 double dt1[16]; // 16点 温度データ
yusuke_kyo 0:8822acabe470 139 short d_PTAT1; // センサ内部PTAT温度データ
yusuke_kyo 0:8822acabe470 140
yusuke_kyo 0:8822acabe470 141 int i,j;
yusuke_kyo 0:8822acabe470 142 int itemp;
yusuke_kyo 0:8822acabe470 143
yusuke_kyo 0:8822acabe470 144 //// measure
yusuke_kyo 0:8822acabe470 145 MEMS1.start();
yusuke_kyo 0:8822acabe470 146 MEMS1.write(D6T_addr);
yusuke_kyo 0:8822acabe470 147 MEMS1.write(D6T_cmd);
yusuke_kyo 0:8822acabe470 148 // Repeated Start condition
yusuke_kyo 0:8822acabe470 149 MEMS1.read(D6T_addr,I2C_rd1,35);
yusuke_kyo 0:8822acabe470 150 // if(check_PEC(I2C_rd) == -1) continue; // error
yusuke_kyo 0:8822acabe470 151 for(i=0,j=0;i<17;i++){
yusuke_kyo 0:8822acabe470 152 itemp = (I2C_rd1[j++] & 0xff);
yusuke_kyo 0:8822acabe470 153 itemp += I2C_rd1[j++] * 256;
yusuke_kyo 0:8822acabe470 154 if(i == 0) PTAT1 = itemp;
yusuke_kyo 0:8822acabe470 155 else datr1[i-1] = itemp;
yusuke_kyo 0:8822acabe470 156 }
yusuke_kyo 0:8822acabe470 157 for(i=0;i<16;i++){
yusuke_kyo 0:8822acabe470 158 dt1[i] = 0.1 * datr1[i];
yusuke_kyo 0:8822acabe470 159 }
yusuke_kyo 0:8822acabe470 160 for(int i=0;i<16;i++){
yusuke_kyo 0:8822acabe470 161 sprintf(con,"%3.1f ",dt1[i]);
yusuke_kyo 0:8822acabe470 162 strcat(data,con);
yusuke_kyo 0:8822acabe470 163 }
yusuke_kyo 2:f0efe1d10f8a 164 if(THERMO_DEBUG){
yusuke_kyo 2:f0efe1d10f8a 165 printf("Thermal_Sensor 1");
yusuke_kyo 2:f0efe1d10f8a 166 for(i=0;i<16;i++){
yusuke_kyo 2:f0efe1d10f8a 167 if(i%4==0) printf("\n");
yusuke_kyo 2:f0efe1d10f8a 168 printf("%3.1f ",dt1[i]);
yusuke_kyo 2:f0efe1d10f8a 169 } printf("\n");
yusuke_kyo 2:f0efe1d10f8a 170 }
yusuke_kyo 0:8822acabe470 171 d_PTAT1 = 0.1 * PTAT1;
yusuke_kyo 0:8822acabe470 172 wait(0.1);
yusuke_kyo 0:8822acabe470 173 /*MEMS1*/
yusuke_kyo 0:8822acabe470 174
yusuke_kyo 0:8822acabe470 175 /*MEMS2*/
yusuke_kyo 0:8822acabe470 176 char I2C_rd2[64]; // 生データ
yusuke_kyo 0:8822acabe470 177 short datr2[16]; // 16点 温度データ(10倍整数)
yusuke_kyo 0:8822acabe470 178 short PTAT2; // センサ内部PTAT温度データ(10倍整数)
yusuke_kyo 0:8822acabe470 179 double dt2[16]; // 16点 温度データ
yusuke_kyo 0:8822acabe470 180 short d_PTAT2; // センサ内部PTAT温度データ
yusuke_kyo 0:8822acabe470 181
yusuke_kyo 0:8822acabe470 182 //// measure
yusuke_kyo 0:8822acabe470 183 MEMS2.start();
yusuke_kyo 0:8822acabe470 184 MEMS2.write(D6T_addr);
yusuke_kyo 0:8822acabe470 185 MEMS2.write(D6T_cmd);
yusuke_kyo 0:8822acabe470 186 // Repeated Start condition
yusuke_kyo 0:8822acabe470 187 MEMS2.read(D6T_addr,I2C_rd2,35);
yusuke_kyo 0:8822acabe470 188 // if(check_PEC(I2C_rd) == -1) continue; // error
yusuke_kyo 0:8822acabe470 189 for(i=0,j=0;i<17;i++){
yusuke_kyo 0:8822acabe470 190 itemp = (I2C_rd2[j++] & 0xff);
yusuke_kyo 0:8822acabe470 191 itemp += I2C_rd2[j++] * 256;
yusuke_kyo 0:8822acabe470 192 if(i == 0) PTAT2 = itemp;
yusuke_kyo 0:8822acabe470 193 else datr2[i-1] = itemp;
yusuke_kyo 0:8822acabe470 194 }
yusuke_kyo 0:8822acabe470 195 for(i=0;i<16;i++){
yusuke_kyo 0:8822acabe470 196 dt2[i] = 0.1 * datr2[i];
yusuke_kyo 0:8822acabe470 197 }
yusuke_kyo 0:8822acabe470 198 for(int i=0;i<16;i++){
yusuke_kyo 0:8822acabe470 199 sprintf(con,"%3.1f ",dt2[i]);
yusuke_kyo 0:8822acabe470 200 strcat(data,con);
yusuke_kyo 0:8822acabe470 201 }
yusuke_kyo 2:f0efe1d10f8a 202 if(THERMO_DEBUG){
yusuke_kyo 2:f0efe1d10f8a 203 printf("Thermal_Sensor 2");
yusuke_kyo 2:f0efe1d10f8a 204 for(i=0;i<16;i++){
yusuke_kyo 2:f0efe1d10f8a 205 if(i%4==0) printf("\n");
yusuke_kyo 2:f0efe1d10f8a 206 printf("%3.1f ",dt2[i]);
yusuke_kyo 2:f0efe1d10f8a 207 } printf("\n");
yusuke_kyo 2:f0efe1d10f8a 208 }
yusuke_kyo 0:8822acabe470 209 d_PTAT2 = 0.1 * PTAT2;
yusuke_kyo 0:8822acabe470 210 wait(0.1);
yusuke_kyo 0:8822acabe470 211 /*MEMS2*/
yusuke_kyo 0:8822acabe470 212 }
yusuke_kyo 0:8822acabe470 213 /*--Thermal_Sensor:end------------------------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 214
yusuke_kyo 0:8822acabe470 215
yusuke_kyo 0:8822acabe470 216 /*--CO2_Sensor:begin--------------------------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 217 /*CO2センサモジュール:A051020-AQ6B-01*/
yusuke_kyo 0:8822acabe470 218 /*データシート:http://www.fisinc.co.jp/common/pdf/A051020-AQ6.pdf*/
yusuke_kyo 0:8822acabe470 219 /*参考 外気:396.0[ppm](2013年) 呼気:13,200[ppm] ※このセンサで測れるのは3000[ppm]まで*/
yusuke_kyo 0:8822acabe470 220 #include "mbed.h"
yusuke_kyo 0:8822acabe470 221
yusuke_kyo 0:8822acabe470 222 AnalogIn ain(p20);
yusuke_kyo 0:8822acabe470 223
yusuke_kyo 2:f0efe1d10f8a 224 #define CO2_DEBUG 0
yusuke_kyo 0:8822acabe470 225
yusuke_kyo 0:8822acabe470 226 float GetCO2() {
yusuke_kyo 0:8822acabe470 227 float v; //生データ:電圧
yusuke_kyo 0:8822acabe470 228 float sensor_v,CO2;
yusuke_kyo 0:8822acabe470 229
yusuke_kyo 0:8822acabe470 230 v = ain.read()*3.3;
yusuke_kyo 0:8822acabe470 231 sensor_v = v * 5.0/3.3; //電圧レベルを合わせる
yusuke_kyo 0:8822acabe470 232 CO2 = sensor_v * 1000 + 400; //データシートより
yusuke_kyo 0:8822acabe470 233
yusuke_kyo 0:8822acabe470 234 if(CO2_DEBUG) printf("\nCO2:%4.1f\n",CO2);
yusuke_kyo 0:8822acabe470 235
yusuke_kyo 0:8822acabe470 236 return(CO2);
yusuke_kyo 0:8822acabe470 237 }
yusuke_kyo 0:8822acabe470 238 /*--CO2_Sensor:end----------------------------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 239
yusuke_kyo 0:8822acabe470 240
yusuke_kyo 0:8822acabe470 241 /*---------------
yusuke_kyo 0:8822acabe470 242 MAIN ROOP
yusuke_kyo 0:8822acabe470 243 ----------------*/
yusuke_kyo 0:8822acabe470 244
yusuke_kyo 0:8822acabe470 245 int main() {
yusuke_kyo 0:8822acabe470 246 char Dyna_data[100];
yusuke_kyo 0:8822acabe470 247 float CO2_data;
yusuke_kyo 0:8822acabe470 248
yusuke_kyo 0:8822acabe470 249 Dyna_init();
yusuke_kyo 0:8822acabe470 250
yusuke_kyo 0:8822acabe470 251 char Send_data[200];
yusuke_kyo 0:8822acabe470 252 int Read_data;
yusuke_kyo 0:8822acabe470 253 int Joy_mode, linear_mode, pitch_mode, yaw_mode;
yusuke_kyo 0:8822acabe470 254
yusuke_kyo 0:8822acabe470 255 while(1) {
yusuke_kyo 0:8822acabe470 256
yusuke_kyo 0:8822acabe470 257 Read_data=pc.getc();
yusuke_kyo 0:8822acabe470 258 wait_ms(1);
yusuke_kyo 2:f0efe1d10f8a 259 Joy_mode = Read_data & 0xc0; Joy_mode = Joy_mode >> 6; //ジョイスティックのモード判定
yusuke_kyo 0:8822acabe470 260
yusuke_kyo 0:8822acabe470 261 switch(Joy_mode){
yusuke_kyo 0:8822acabe470 262 case 0: //通常モード
yusuke_kyo 0:8822acabe470 263 myled1=0; myled2=0; myled3=0; myled4=0;
yusuke_kyo 0:8822acabe470 264 /*--Dynamixel:begin---------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 265 //Dynamixelへの命令を判定
yusuke_kyo 2:f0efe1d10f8a 266 linear_mode = Read_data & 0x30; linear_mode = linear_mode >> 4;
yusuke_kyo 2:f0efe1d10f8a 267 pitch_mode = Read_data & 0x0c; pitch_mode = pitch_mode >> 2;
yusuke_kyo 2:f0efe1d10f8a 268 yaw_mode = Read_data & 0x03;
yusuke_kyo 0:8822acabe470 269
yusuke_kyo 0:8822acabe470 270 //現在の角度・電圧・電流を取得
yusuke_kyo 0:8822acabe470 271 myled1=1;
yusuke_kyo 0:8822acabe470 272 Dyna_GetData(Dyna_data);
yusuke_kyo 0:8822acabe470 273 myled1=0;
yusuke_kyo 0:8822acabe470 274
yusuke_kyo 0:8822acabe470 275 //目標角度を変更
yusuke_kyo 0:8822acabe470 276 myled2=1;
yusuke_kyo 0:8822acabe470 277 Dyna_SetGoal(linear_mode, pitch_mode, yaw_mode);
yusuke_kyo 0:8822acabe470 278 myled2=0;
yusuke_kyo 0:8822acabe470 279 /*--Dynamixel:end------------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 280
yusuke_kyo 0:8822acabe470 281 /*--Thermal_Sensor:begin-----------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 282 //値を取得
yusuke_kyo 0:8822acabe470 283 myled3=1;
yusuke_kyo 1:bf4d524625f5 284 char Thermo_data[100];
yusuke_kyo 0:8822acabe470 285 GetThermo(Thermo_data);
yusuke_kyo 0:8822acabe470 286 /*--Thermal_Sensor:end-------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 287
yusuke_kyo 0:8822acabe470 288 /*--CO2_Sensor:begin---------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 289 //値を取得
yusuke_kyo 0:8822acabe470 290 CO2_data=GetCO2();
yusuke_kyo 0:8822acabe470 291 myled3=0;
yusuke_kyo 0:8822acabe470 292 /*--CO2_Sensor:end-----------------------------------------------------------------*/
yusuke_kyo 0:8822acabe470 293
yusuke_kyo 0:8822acabe470 294 //値を送信
yusuke_kyo 0:8822acabe470 295 myled4=1;
yusuke_kyo 0:8822acabe470 296 sprintf(Send_data,"%s%s%f",Dyna_data,Thermo_data,CO2_data);
yusuke_kyo 0:8822acabe470 297 printf("%s\n",Send_data);
yusuke_kyo 0:8822acabe470 298 myled4=0;
yusuke_kyo 0:8822acabe470 299 break;
yusuke_kyo 0:8822acabe470 300
yusuke_kyo 0:8822acabe470 301 case 1: //ホームポジション
yusuke_kyo 0:8822acabe470 302 myled1=1; myled2=0; myled3=0; myled4=1; Dyna_home_position(); break;
yusuke_kyo 0:8822acabe470 303
yusuke_kyo 0:8822acabe470 304 case 2: //リセット
yusuke_kyo 0:8822acabe470 305 myled1=0; myled2=1; myled3=1; myled4=0; Dyna_reset(); break;
yusuke_kyo 0:8822acabe470 306
yusuke_kyo 0:8822acabe470 307 case 3: //終了
yusuke_kyo 0:8822acabe470 308 myled1=1; myled2=1; myled3=1; myled4=1; Dyna_end(); break;
yusuke_kyo 0:8822acabe470 309 }
yusuke_kyo 0:8822acabe470 310 }
yusuke_kyo 0:8822acabe470 311 }