test

Dependencies:   mbed-STM32F103C8T6 mbed-rtos mbed-dev

Committer:
bbw
Date:
Wed May 06 10:03:17 2020 +0000
Revision:
11:9dc8bbb8dda3
Parent:
10:ef9fa7e34eff
test only;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
techneo 0:217105958c2d 1 #include "mbed.h"
bbw 1:0fe432e5dfc4 2 #include "stm32f103c8t6.h"
bbw 10:ef9fa7e34eff 3 #include <string>
hankzhang 4:864bb8bde75c 4 #include "stdio.h"
hankzhang 4:864bb8bde75c 5 #include "stdlib.h"
bbw 10:ef9fa7e34eff 6 #include "rtos.h"
bbw 6:a9cc2c424cf9 7
bbw 11:9dc8bbb8dda3 8 #define MAX_LENGTH_STEPS 55
bbw 11:9dc8bbb8dda3 9 #define MIN_LENGTH_STEPS 10
bbw 11:9dc8bbb8dda3 10 #define MOVING_UP 1
bbw 11:9dc8bbb8dda3 11 #define MOVING_DOWN 2
bbw 11:9dc8bbb8dda3 12 #define MOVING_FORWARD 1
bbw 11:9dc8bbb8dda3 13 #define MOVING_BACKWARD 2
bbw 11:9dc8bbb8dda3 14 #define STOP 0
bbw 11:9dc8bbb8dda3 15 #define DEBOUNCE 4 /*4*20ms*/
techneo 0:217105958c2d 16
bbw 11:9dc8bbb8dda3 17 DigitalOut MOTOA1(PB_4);
bbw 11:9dc8bbb8dda3 18 DigitalOut MOTOB1(PB_5);
bbw 8:a32b83084287 19
bbw 11:9dc8bbb8dda3 20 DigitalOut MOTOA2(PB_8);
bbw 11:9dc8bbb8dda3 21 DigitalOut MOTOB2(PB_9);
bbw 11:9dc8bbb8dda3 22
bbw 11:9dc8bbb8dda3 23 AnalogIn SensorCurrent(PA_0);
hankzhang 4:864bb8bde75c 24
bbw 11:9dc8bbb8dda3 25 void motor1_move(uint8_t dir);
bbw 11:9dc8bbb8dda3 26 void motor2_move(uint8_t dir);
bbw 11:9dc8bbb8dda3 27
bbw 11:9dc8bbb8dda3 28 uint8_t sensor_cnt,cal_cnt, cur_cnt, tar_cnt, pre_sensor_cnt;
bbw 11:9dc8bbb8dda3 29 float sense_value;
bbw 11:9dc8bbb8dda3 30 uint8_t ov_flag, init_flag;
bbw 11:9dc8bbb8dda3 31 uint8_t open_flag,close_flag;
hankzhang 4:864bb8bde75c 32
bbw 11:9dc8bbb8dda3 33 #if 1 /*WIFI related*/
bbw 11:9dc8bbb8dda3 34 DigitalOut led1(PC_13);
bbw 11:9dc8bbb8dda3 35 Serial debug_uart(PB_10, PB_11, 115200);
bbw 11:9dc8bbb8dda3 36 Serial wifi_uart(PA_2, PA_3, 115200);
bbw 11:9dc8bbb8dda3 37 Timer timer; /*used by led0_thread*/
bbw 11:9dc8bbb8dda3 38 string a(""); /*reserved*/
bbw 11:9dc8bbb8dda3 39 string b(""); /*used by led0_thread*/
bbw 11:9dc8bbb8dda3 40 char g_isCloud = 0; //flag for connected xiaomi cloud
bbw 11:9dc8bbb8dda3 41 #endif
hankzhang 3:30d61fa10b98 42
bbw 11:9dc8bbb8dda3 43 Timer timer_m;
bbw 10:ef9fa7e34eff 44 int flag = 0;
hankzhang 7:155d5b6a416f 45
bbw 11:9dc8bbb8dda3 46 void Power_thread(void const *argument){/*detect current*/
bbw 11:9dc8bbb8dda3 47 char i = 0;
bbw 11:9dc8bbb8dda3 48 while(true){
bbw 11:9dc8bbb8dda3 49 Thread::wait(200); /*unit millisec*/
bbw 11:9dc8bbb8dda3 50 sense_value = SensorCurrent.read();
bbw 11:9dc8bbb8dda3 51 //debug_uart.printf("dfdfdfdfddfdf\r\n");
bbw 11:9dc8bbb8dda3 52 if(sense_value>0.5){
bbw 11:9dc8bbb8dda3 53 debug_uart.printf("Power_thread: sense_value = %0.4f > 0.5 \r\n", sense_value);
bbw 11:9dc8bbb8dda3 54 i++;
bbw 11:9dc8bbb8dda3 55 if(i>1){
bbw 11:9dc8bbb8dda3 56 ov_flag = 1;
bbw 11:9dc8bbb8dda3 57 }
bbw 11:9dc8bbb8dda3 58 }else{
bbw 11:9dc8bbb8dda3 59 i = 0;
bbw 11:9dc8bbb8dda3 60 }
bbw 11:9dc8bbb8dda3 61 }
bbw 11:9dc8bbb8dda3 62 }
bbw 11:9dc8bbb8dda3 63
bbw 11:9dc8bbb8dda3 64 char CheckStopper(int ch){
bbw 11:9dc8bbb8dda3 65 DigitalIn Stopper1(PA_13);
bbw 11:9dc8bbb8dda3 66 DigitalIn Stopper2(PA_15);
bbw 11:9dc8bbb8dda3 67 timer_m.reset();
bbw 11:9dc8bbb8dda3 68 char i = 0;
bbw 11:9dc8bbb8dda3 69 while(ch == MOVING_UP){
bbw 11:9dc8bbb8dda3 70 if(!Stopper1){i++;};
bbw 11:9dc8bbb8dda3 71 if(i>DEBOUNCE){break;}
bbw 11:9dc8bbb8dda3 72 if(timer_m.read_ms()>5000){return 1;}
bbw 11:9dc8bbb8dda3 73 wait_ms(20);
bbw 8:a32b83084287 74 }
bbw 11:9dc8bbb8dda3 75 while(ch == MOVING_DOWN){
bbw 11:9dc8bbb8dda3 76 if(!Stopper2){i++;};
bbw 11:9dc8bbb8dda3 77 if(i>DEBOUNCE){break;}
bbw 11:9dc8bbb8dda3 78 if(timer_m.read_ms()>5000){return 1;}
bbw 11:9dc8bbb8dda3 79 wait_ms(20);
bbw 11:9dc8bbb8dda3 80 }
bbw 11:9dc8bbb8dda3 81 return 0;
hankzhang 7:155d5b6a416f 82 }
hankzhang 7:155d5b6a416f 83
bbw 11:9dc8bbb8dda3 84 void Motor_thread(void const *argument){
bbw 11:9dc8bbb8dda3 85 while(true){
bbw 11:9dc8bbb8dda3 86 Thread::wait(200); /*unit millisec*/
bbw 11:9dc8bbb8dda3 87 if(!init_flag){
bbw 11:9dc8bbb8dda3 88 wait(1);
bbw 11:9dc8bbb8dda3 89 debug_uart.printf("Motor_thread: motor2 move up\r\n");
bbw 11:9dc8bbb8dda3 90 motor2_move(MOVING_UP);
bbw 11:9dc8bbb8dda3 91 if(CheckStopper(MOVING_UP)){
bbw 11:9dc8bbb8dda3 92 debug_uart.printf("Motor_thread: motor2 timeout, stop motor2 and finish the calibration\r\n");
bbw 11:9dc8bbb8dda3 93 init_flag = 1;
bbw 11:9dc8bbb8dda3 94 motor2_move(STOP);
bbw 11:9dc8bbb8dda3 95 continue;
bbw 11:9dc8bbb8dda3 96 }
bbw 11:9dc8bbb8dda3 97 motor2_move(STOP);
bbw 11:9dc8bbb8dda3 98 wait(1);
bbw 11:9dc8bbb8dda3 99 debug_uart.printf("Motor_thread: motor1 move forward\r\n");
bbw 11:9dc8bbb8dda3 100 sensor_cnt = 0;
bbw 11:9dc8bbb8dda3 101 motor1_move(MOVING_FORWARD);
bbw 11:9dc8bbb8dda3 102 while(1){
bbw 11:9dc8bbb8dda3 103 if(ov_flag){
bbw 11:9dc8bbb8dda3 104 motor1_move(STOP);
bbw 11:9dc8bbb8dda3 105 cal_cnt = sensor_cnt;
bbw 11:9dc8bbb8dda3 106 ov_flag = 0;
bbw 11:9dc8bbb8dda3 107 break;
bbw 11:9dc8bbb8dda3 108 }
bbw 11:9dc8bbb8dda3 109 }
bbw 11:9dc8bbb8dda3 110 wait(1);
bbw 11:9dc8bbb8dda3 111 debug_uart.printf("Motor_thread: motor2 move down\r\n");
bbw 11:9dc8bbb8dda3 112 motor2_move(MOVING_DOWN);
bbw 11:9dc8bbb8dda3 113 if(CheckStopper(MOVING_DOWN)){
bbw 11:9dc8bbb8dda3 114 debug_uart.printf("Motor_thread: motor2 timeout, stop motor2 and finish the calibration\r\n");
bbw 11:9dc8bbb8dda3 115 init_flag = 1;
bbw 11:9dc8bbb8dda3 116 motor2_move(STOP);
bbw 11:9dc8bbb8dda3 117 continue;
bbw 11:9dc8bbb8dda3 118 }
bbw 11:9dc8bbb8dda3 119 motor2_move(STOP);
bbw 11:9dc8bbb8dda3 120 wait(1);
bbw 11:9dc8bbb8dda3 121 debug_uart.printf("Motor_thread: motor1 move backward\r\n");
bbw 11:9dc8bbb8dda3 122 sensor_cnt = 0;
bbw 11:9dc8bbb8dda3 123 motor1_move(MOVING_BACKWARD);
bbw 11:9dc8bbb8dda3 124 while(1){
bbw 11:9dc8bbb8dda3 125 if(ov_flag){
bbw 11:9dc8bbb8dda3 126 motor1_move(STOP);
bbw 11:9dc8bbb8dda3 127 ov_flag = 0;
bbw 11:9dc8bbb8dda3 128 debug_uart.printf("Motor_thread: cal_cnt = %d, 1/2(cal_cnt+sensor_cnt)\r\n", (cal_cnt+sensor_cnt)/2);
bbw 11:9dc8bbb8dda3 129 break;
bbw 11:9dc8bbb8dda3 130 }
bbw 11:9dc8bbb8dda3 131 if(sensor_cnt>=cal_cnt){
bbw 11:9dc8bbb8dda3 132 motor1_move(STOP);
bbw 11:9dc8bbb8dda3 133 debug_uart.printf("Motor_thread: cal_cnt = %d\r\n", cal_cnt);
bbw 11:9dc8bbb8dda3 134 break;
bbw 11:9dc8bbb8dda3 135 }
bbw 11:9dc8bbb8dda3 136 }
bbw 11:9dc8bbb8dda3 137 cur_cnt = 0;
bbw 11:9dc8bbb8dda3 138 wait(1);
bbw 11:9dc8bbb8dda3 139 debug_uart.printf("Motor_thread: motor2 move to center\r\n");
bbw 11:9dc8bbb8dda3 140 motor2_move(MOVING_UP);
bbw 11:9dc8bbb8dda3 141 wait(1.6);
bbw 11:9dc8bbb8dda3 142 motor2_move(STOP);
bbw 11:9dc8bbb8dda3 143 init_flag = 1;
bbw 11:9dc8bbb8dda3 144 debug_uart.printf("Motor_thread: auto-curtain length was calibrated sucessfully\r\n");
bbw 11:9dc8bbb8dda3 145 }else{
bbw 11:9dc8bbb8dda3 146 debug_uart.printf("Motor_thread: auto-curtain is waiting for command\r\n");
bbw 11:9dc8bbb8dda3 147 wait(3);
bbw 11:9dc8bbb8dda3 148 }
bbw 11:9dc8bbb8dda3 149 }
bbw 10:ef9fa7e34eff 150 }
bbw 10:ef9fa7e34eff 151
bbw 10:ef9fa7e34eff 152 void led0_thread(void const *argument) {
bbw 10:ef9fa7e34eff 153 int err;
bbw 10:ef9fa7e34eff 154 char rxBuf[32];
bbw 10:ef9fa7e34eff 155 char wifi_rxBuf[32];
bbw 10:ef9fa7e34eff 156 char i;
bbw 11:9dc8bbb8dda3 157 int position;
bbw 11:9dc8bbb8dda3 158 char dat[2];
bbw 11:9dc8bbb8dda3 159
bbw 10:ef9fa7e34eff 160 while (1) {
bbw 10:ef9fa7e34eff 161 wifi_uart.printf("get_down\r");
bbw 11:9dc8bbb8dda3 162 timer.reset();
bbw 11:9dc8bbb8dda3 163 b.clear();
bbw 10:ef9fa7e34eff 164 while(timer.read_ms()<5000){
bbw 10:ef9fa7e34eff 165 if(wifi_uart.readable()){
bbw 10:ef9fa7e34eff 166 char ch = wifi_uart.getc();
bbw 10:ef9fa7e34eff 167 if(ch!=0x0d){
bbw 10:ef9fa7e34eff 168 b += ch;
bbw 10:ef9fa7e34eff 169 }else{
bbw 10:ef9fa7e34eff 170 debug_uart.printf("get string: %s \r\n", b.c_str());
bbw 11:9dc8bbb8dda3 171 #if 1
bbw 11:9dc8bbb8dda3 172 if(!strncmp(b.c_str(),"down none",9))
bbw 10:ef9fa7e34eff 173 {
bbw 10:ef9fa7e34eff 174 //debug_uart.printf("--- none\r\n");
bbw 10:ef9fa7e34eff 175 }
bbw 10:ef9fa7e34eff 176 if(!(strncmp(b.c_str(),"down set_properties",19)))
bbw 10:ef9fa7e34eff 177 {
bbw 11:9dc8bbb8dda3 178 //debug_uart.printf("--- set_properties\r\n");
bbw 11:9dc8bbb8dda3 179 b.erase(0,b.length()-3);
bbw 11:9dc8bbb8dda3 180 position = atoi(b.c_str());
bbw 11:9dc8bbb8dda3 181 debug_uart.printf("position = %d\r\n",position);
bbw 10:ef9fa7e34eff 182 wifi_uart.printf("result 2 7 0\r\n");
bbw 11:9dc8bbb8dda3 183 b.clear();
bbw 11:9dc8bbb8dda3 184 continue;
bbw 10:ef9fa7e34eff 185 }
bbw 10:ef9fa7e34eff 186 if(!(strncmp(b.c_str(),"down get_properties",19)))
bbw 10:ef9fa7e34eff 187 {
bbw 11:9dc8bbb8dda3 188 //debug_uart.printf("--- get_properties\r\n");
bbw 11:9dc8bbb8dda3 189 wifi_uart.printf("result 2 4 0 10 2 6 0 %d 2 7 30\r\n", position);
bbw 11:9dc8bbb8dda3 190 b.clear();
bbw 11:9dc8bbb8dda3 191 continue;
bbw 10:ef9fa7e34eff 192 }
bbw 10:ef9fa7e34eff 193 if(!strncmp(b.c_str(),"down MIIO_net_change",20))
bbw 10:ef9fa7e34eff 194 {
bbw 10:ef9fa7e34eff 195 if((!strncmp(b.c_str()+21, "offline", 7)))
bbw 10:ef9fa7e34eff 196 {
bbw 11:9dc8bbb8dda3 197 //debug_uart.printf("offline\r\n");
bbw 10:ef9fa7e34eff 198 }
bbw 10:ef9fa7e34eff 199 if((!strncmp(b.c_str()+21, "local", 5)))
bbw 10:ef9fa7e34eff 200 {
bbw 11:9dc8bbb8dda3 201 //debug_uart.printf("local\r\n");
bbw 10:ef9fa7e34eff 202 }
bbw 10:ef9fa7e34eff 203 if((!strncmp(b.c_str()+21, "cloud", 5)))
bbw 10:ef9fa7e34eff 204 {
bbw 11:9dc8bbb8dda3 205 //debug_uart.printf("cloud\r\n");
bbw 10:ef9fa7e34eff 206 }
bbw 10:ef9fa7e34eff 207 }
bbw 11:9dc8bbb8dda3 208 #endif
bbw 10:ef9fa7e34eff 209 break;
bbw 10:ef9fa7e34eff 210 }
bbw 10:ef9fa7e34eff 211 }
bbw 10:ef9fa7e34eff 212 }
bbw 11:9dc8bbb8dda3 213 while(wifi_uart.readable()){wifi_uart.getc();}
bbw 10:ef9fa7e34eff 214 wait_ms(400);
bbw 10:ef9fa7e34eff 215 }
hankzhang 7:155d5b6a416f 216 }
hankzhang 7:155d5b6a416f 217
bbw 11:9dc8bbb8dda3 218 void serialprocess(void const *argument){
bbw 11:9dc8bbb8dda3 219 while(1){
bbw 11:9dc8bbb8dda3 220 if(debug_uart.readable()){
bbw 11:9dc8bbb8dda3 221 char ch = debug_uart.getc();
bbw 11:9dc8bbb8dda3 222 if(ch!=0x0d){
bbw 11:9dc8bbb8dda3 223 a += ch;
bbw 11:9dc8bbb8dda3 224 }else{
bbw 11:9dc8bbb8dda3 225 debug_uart.printf("get command from uart: '%s'\r\n", a.c_str());
bbw 11:9dc8bbb8dda3 226 if(!strncmp(a.c_str(),"stp1",4)){
bbw 11:9dc8bbb8dda3 227 debug_uart.printf("stepper1 ready\r\n");
bbw 11:9dc8bbb8dda3 228 }
bbw 11:9dc8bbb8dda3 229 if(!strncmp(a.c_str(),"stp2",4)){
bbw 11:9dc8bbb8dda3 230 debug_uart.printf("stepper2 ready\r\n");
bbw 11:9dc8bbb8dda3 231 }
bbw 11:9dc8bbb8dda3 232 if(!strncmp(a.c_str(),"ovflag",6)){
bbw 11:9dc8bbb8dda3 233 debug_uart.printf("ovflag = 1\r\n");
bbw 11:9dc8bbb8dda3 234 }
bbw 11:9dc8bbb8dda3 235 a.clear();
bbw 11:9dc8bbb8dda3 236 }
bbw 11:9dc8bbb8dda3 237 }
bbw 10:ef9fa7e34eff 238 }
bbw 11:9dc8bbb8dda3 239 }
bbw 11:9dc8bbb8dda3 240
bbw 11:9dc8bbb8dda3 241 void serialIRQ(void){
bbw 11:9dc8bbb8dda3 242 debug_uart.putc(debug_uart.getc());
bbw 11:9dc8bbb8dda3 243 }
bbw 11:9dc8bbb8dda3 244
bbw 11:9dc8bbb8dda3 245 void sensor_capture_cb(void){
bbw 11:9dc8bbb8dda3 246 sensor_cnt++;
bbw 11:9dc8bbb8dda3 247 if(open_flag){
bbw 11:9dc8bbb8dda3 248 if(cur_cnt<tar_cnt){
bbw 11:9dc8bbb8dda3 249 cur_cnt++;
bbw 11:9dc8bbb8dda3 250 }
bbw 11:9dc8bbb8dda3 251 }
bbw 11:9dc8bbb8dda3 252 if(close_flag){
bbw 11:9dc8bbb8dda3 253 if(cur_cnt>0){
bbw 11:9dc8bbb8dda3 254 cur_cnt--;
hankzhang 7:155d5b6a416f 255 }
bbw 8:a32b83084287 256 }
hankzhang 7:155d5b6a416f 257 }
hankzhang 7:155d5b6a416f 258
bbw 11:9dc8bbb8dda3 259 void motor1_move(uint8_t dir){/*main motor*/
bbw 11:9dc8bbb8dda3 260 if(dir==1){/*forward*/
bbw 11:9dc8bbb8dda3 261 MOTOA1 = 0;
bbw 11:9dc8bbb8dda3 262 MOTOB1 = 1;
bbw 11:9dc8bbb8dda3 263 }else if(dir==2){/*backward*/
bbw 11:9dc8bbb8dda3 264 MOTOA1 = 1;
bbw 11:9dc8bbb8dda3 265 MOTOB1 = 0;
bbw 11:9dc8bbb8dda3 266 }else{ /*stop*/
bbw 11:9dc8bbb8dda3 267 MOTOA1 = 0;
bbw 11:9dc8bbb8dda3 268 MOTOB1 = 0;
bbw 11:9dc8bbb8dda3 269 }
bbw 11:9dc8bbb8dda3 270 }
bbw 11:9dc8bbb8dda3 271
bbw 11:9dc8bbb8dda3 272 void motor2_move(uint8_t dir){/*assistant motor*/
bbw 11:9dc8bbb8dda3 273 if(dir==1){/*up*/
bbw 11:9dc8bbb8dda3 274 MOTOA2 = 0;
bbw 11:9dc8bbb8dda3 275 MOTOB2 = 1;
bbw 11:9dc8bbb8dda3 276 }else if(dir==2){/*down*/
bbw 11:9dc8bbb8dda3 277 MOTOA2 = 1;
bbw 11:9dc8bbb8dda3 278 MOTOB2 = 0;
bbw 11:9dc8bbb8dda3 279 }else{ /*stop*/
bbw 11:9dc8bbb8dda3 280 MOTOA2 = 0;
bbw 11:9dc8bbb8dda3 281 MOTOB2 = 0;
bbw 11:9dc8bbb8dda3 282 }
bbw 11:9dc8bbb8dda3 283 }
bbw 11:9dc8bbb8dda3 284
bbw 11:9dc8bbb8dda3 285
bbw 11:9dc8bbb8dda3 286 void system_init(){
bbw 11:9dc8bbb8dda3 287 MOTOA1 = 0;
bbw 11:9dc8bbb8dda3 288 MOTOB1 = 0;
bbw 11:9dc8bbb8dda3 289 MOTOA2 = 0;
bbw 11:9dc8bbb8dda3 290 MOTOB2 = 0;
bbw 11:9dc8bbb8dda3 291 init_flag = 0;
bbw 11:9dc8bbb8dda3 292 cur_cnt = 0;
bbw 11:9dc8bbb8dda3 293 cal_cnt = 0;
bbw 11:9dc8bbb8dda3 294 sense_value = 0;
bbw 11:9dc8bbb8dda3 295 debug_uart.printf("\r\n");
bbw 11:9dc8bbb8dda3 296 debug_uart.printf("************************************************\r\n");
bbw 11:9dc8bbb8dda3 297 debug_uart.printf("******************LAIWU TECH********************\r\n");
bbw 11:9dc8bbb8dda3 298 debug_uart.printf("************************************************\r\n");
bbw 11:9dc8bbb8dda3 299 debug_uart.printf("****system init done, wait 3 seconds to start***\r\n");
bbw 11:9dc8bbb8dda3 300 wait(3);
bbw 11:9dc8bbb8dda3 301 }
bbw 11:9dc8bbb8dda3 302
bbw 10:ef9fa7e34eff 303 int main() {
bbw 1:0fe432e5dfc4 304
bbw 11:9dc8bbb8dda3 305 system_init();
bbw 11:9dc8bbb8dda3 306
bbw 10:ef9fa7e34eff 307 led1 = 1;
bbw 11:9dc8bbb8dda3 308 flag = 0;
bbw 11:9dc8bbb8dda3 309
bbw 11:9dc8bbb8dda3 310 wait(3);
bbw 11:9dc8bbb8dda3 311
bbw 11:9dc8bbb8dda3 312 InterruptIn Hall1(PA_14);
bbw 11:9dc8bbb8dda3 313 Hall1.fall(callback(sensor_capture_cb)); // Attach ISR to handle button press event
bbw 10:ef9fa7e34eff 314
bbw 11:9dc8bbb8dda3 315 debug_uart.printf("************************************************\r\n");
bbw 11:9dc8bbb8dda3 316 debug_uart.printf("***************hall sensor init*****************\r\n");
bbw 11:9dc8bbb8dda3 317
hankzhang 7:155d5b6a416f 318
bbw 11:9dc8bbb8dda3 319 //Thread thread2(Power_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); /*check the real-time current*/
bbw 11:9dc8bbb8dda3 320 debug_uart.printf("**********************2*************************\r\n");
bbw 11:9dc8bbb8dda3 321 //Thread thread3(Motor_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); /*check the real-time current*/
bbw 11:9dc8bbb8dda3 322 debug_uart.printf("**********************3*************************\r\n");
bbw 11:9dc8bbb8dda3 323 Thread thread1(led0_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); /*check the wifi connection*/
bbw 11:9dc8bbb8dda3 324 debug_uart.printf("**********************1*************************\r\n");
bbw 10:ef9fa7e34eff 325
bbw 11:9dc8bbb8dda3 326 debug_uart.printf("**************three threads init****************\r\n");
bbw 11:9dc8bbb8dda3 327
bbw 11:9dc8bbb8dda3 328 timer.start();
bbw 11:9dc8bbb8dda3 329 timer_m.start();
bbw 11:9dc8bbb8dda3 330
bbw 11:9dc8bbb8dda3 331 debug_uart.printf("************************************************\r\n");
bbw 11:9dc8bbb8dda3 332 debug_uart.printf("****************two timer init*****************\r\n");
bbw 11:9dc8bbb8dda3 333
bbw 11:9dc8bbb8dda3 334 debug_uart.attach(&serialIRQ, Serial::RxIrq);
bbw 10:ef9fa7e34eff 335
hankzhang 7:155d5b6a416f 336 while(1)
hankzhang 7:155d5b6a416f 337 {
bbw 11:9dc8bbb8dda3 338 wait(1);
bbw 11:9dc8bbb8dda3 339 //wifi_uart.printf("get_down\r");
bbw 11:9dc8bbb8dda3 340 //debug_uart.printf("************************************************\r\n");
bbw 11:9dc8bbb8dda3 341 //debug_uart.printf("********************%%%%%***********************\r\n");
hankzhang 7:155d5b6a416f 342 }
hankzhang 2:f48b0967b6cc 343 }