svoe
Dependencies: mbed mbed-STM32F103C8T6 MPU6050_1
wifi.h@3:8e8458f45d19, 2017-05-07 (annotated)
- Committer:
- Stas285
- Date:
- Sun May 07 08:37:22 2017 +0000
- Revision:
- 3:8e8458f45d19
- Parent:
- 2:f170902b3a15
- Child:
- 9:8f98b1c277a4
wifi+echo scan+rc+921600
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{ |
Stas285 | 3:8e8458f45d19 | 16 | if (external_command < 128){speed = 2*(external_command - 20);} //Command Speed |
Stas285 | 3:8e8458f45d19 | 17 | else {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 | } |