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 mbed-STM32F103C8T6 MPU6050_1
wifi.h
00001 unsigned char volatile external_command = 0; 00002 00003 void command_receive(){ 00004 external_command = wifi.getc(); 00005 //myled = !myled; 00006 } 00007 00008 void command_process(){ // Interrupt !!! - transfer to main 00009 int command = int(external_command/64); 00010 int value = external_command & 0x3f; 00011 switch (command){ 00012 case 0: x_prop = value * 10; break; //target.x = (float) value/100; break; 00013 case 1: x_diff = value * 10; break; //target.y = (float) value/100; break; 00014 case 2: balance_prop = value / 10; break; 00015 case 3: balance_diff = value; break; 00016 } 00017 00018 /*if(external_command > 0xf0){ //16 commands w/o parameters 00019 switch (external_command){ 00020 case 0xff: {stop(); break;} //Command Stop 00021 case 0xfe: {dance(10,2); break;} //Command Dance 00022 } 00023 } 00024 else{ 00025 if (external_command < 128) k_1 = 0.05*(external_command - 10); //{speed = 2*(external_command - 20);} //Command Speed 00026 else k_2 = 0.05*(external_command - 128 - 10); // {if ((external_command - 128 - 20) == 0)radius = 1e5; else radius = 100/(external_command - 128 - 20);} //Command Turn 00027 stop_flag = 0; infinite_flag = 1; motor_enable = 1; motor_busy = 1; 00028 }*/ 00029 external_command = 0; 00030 } 00031 00032 void wifi_init(){ 00033 wifi.attach(&command_receive); 00034 }
Generated on Thu Jul 28 2022 12:08:13 by
1.7.2