svoe
Dependencies: mbed mbed-STM32F103C8T6 MPU6050_1
wifi.h@9:8f98b1c277a4, 2017-09-16 (annotated)
- Committer:
- dima285
- Date:
- Sat Sep 16 13:24:25 2017 +0000
- Revision:
- 9:8f98b1c277a4
- Parent:
- 3:8e8458f45d19
- Child:
- 12:721a9ea55e91
shoto rabotaet
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Stas285 | 3:8e8458f45d19 | 1 | unsigned char volatile external_command = 0; |
Stas285 | 3:8e8458f45d19 | 2 | |
Stas285 | 3:8e8458f45d19 | 3 | void command_receive(){ |
Stas285 | 3:8e8458f45d19 | 4 | external_command = wifi.getc(); |
Stas285 | 3:8e8458f45d19 | 5 | //myled = !myled; |
Stas285 | 3:8e8458f45d19 | 6 | } |
Stas285 | 3:8e8458f45d19 | 7 | |
Stas285 | 3:8e8458f45d19 | 8 | void command_process(){ // Interrupt !!! - transfer to main |
Stas285 | 3:8e8458f45d19 | 9 | if(external_command > 0xf0){ //16 commands w/o parameters |
Stas285 | 3:8e8458f45d19 | 10 | switch (external_command){ |
Stas285 | 3:8e8458f45d19 | 11 | case 0xff: {stop(); break;} //Command Stop |
Stas285 | 3:8e8458f45d19 | 12 | case 0xfe: {dance(10,2); break;} //Command Dance |
Stas285 | 3:8e8458f45d19 | 13 | } |
Stas285 | 3:8e8458f45d19 | 14 | } |
Stas285 | 1:e2a6e523bf1f | 15 | else{ |
dima285 | 9:8f98b1c277a4 | 16 | if (external_command < 128) k_1 = 0.05*(external_command - 10); //{speed = 2*(external_command - 20);} //Command Speed |
dima285 | 9:8f98b1c277a4 | 17 | 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 |
Stas285 | 3:8e8458f45d19 | 18 | stop_flag = 0; infinite_flag = 1; motor_enable = 1; motor_busy = 1; |
Stas285 | 1:e2a6e523bf1f | 19 | } |
Stas285 | 3:8e8458f45d19 | 20 | external_command = 0; |
Stas285 | 1:e2a6e523bf1f | 21 | } |
Stas285 | 1:e2a6e523bf1f | 22 | |
Stas285 | 0:e9488589a8ee | 23 | void wifi_init(){ |
Stas285 | 3:8e8458f45d19 | 24 | wifi.attach(&command_receive); |
Stas285 | 1:e2a6e523bf1f | 25 | } |