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
main.cpp@1:72b8490a4ece, 2019-08-28 (annotated)
- Committer:
- st17099ng
- Date:
- Wed Aug 28 01:27:36 2019 +0000
- Revision:
- 1:72b8490a4ece
- Parent:
- 0:bba4760cb391
2019Korobo
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| st17099ng | 0:bba4760cb391 | 1 | #include "mbed.h" |
| st17099ng | 0:bba4760cb391 | 2 | #include "Help.h" |
| st17099ng | 0:bba4760cb391 | 3 | |
| st17099ng | 0:bba4760cb391 | 4 | Serial pc(USBTX,USBRX); |
| st17099ng | 0:bba4760cb391 | 5 | DigitalOut POWER_LED(D5); |
| st17099ng | 0:bba4760cb391 | 6 | |
| st17099ng | 1:72b8490a4ece | 7 | static int direct,speed; |
| st17099ng | 1:72b8490a4ece | 8 | static char wheel_RF,wheel_LF; |
| st17099ng | 1:72b8490a4ece | 9 | static char wheel_RB,wheel_LB; |
| st17099ng | 1:72b8490a4ece | 10 | static char arm_moter; |
| st17099ng | 0:bba4760cb391 | 11 | |
| st17099ng | 0:bba4760cb391 | 12 | int main(void) |
| st17099ng | 0:bba4760cb391 | 13 | { |
| st17099ng | 1:72b8490a4ece | 14 | POWER_LED = 1; |
| st17099ng | 0:bba4760cb391 | 15 | speed = fast; |
| st17099ng | 1:72b8490a4ece | 16 | direct = SBREAK; |
| st17099ng | 1:72b8490a4ece | 17 | format_data(&wheel_RF); |
| st17099ng | 1:72b8490a4ece | 18 | format_data(&wheel_LF); |
| st17099ng | 1:72b8490a4ece | 19 | format_data(&wheel_RB); |
| st17099ng | 1:72b8490a4ece | 20 | format_data(&wheel_LB); |
| st17099ng | 1:72b8490a4ece | 21 | format_data(&arm_moter); |
| st17099ng | 0:bba4760cb391 | 22 | while(1) { |
| st17099ng | 0:bba4760cb391 | 23 | set_emg(); |
| st17099ng | 1:72b8490a4ece | 24 | set_direct(&direct); |
| st17099ng | 1:72b8490a4ece | 25 | set_speed(&speed); |
| st17099ng | 1:72b8490a4ece | 26 | set_mot(&arm_moter, cir, cro); |
| st17099ng | 0:bba4760cb391 | 27 | if(direct != 0) { |
| st17099ng | 1:72b8490a4ece | 28 | set_tire(&wheel_RF, &wheel_RB, direct, 'R', speed); |
| st17099ng | 1:72b8490a4ece | 29 | set_tire(&wheel_LF, &wheel_LB, direct, 'L', speed); |
| st17099ng | 0:bba4760cb391 | 30 | } else { |
| st17099ng | 1:72b8490a4ece | 31 | set_slide(&wheel_RF,&wheel_LF,&wheel_RB,&wheel_LB,r1,l1, speed); |
| st17099ng | 0:bba4760cb391 | 32 | } |
| st17099ng | 0:bba4760cb391 | 33 | |
| st17099ng | 1:72b8490a4ece | 34 | write_data(Rf_add,wheel_RF); |
| st17099ng | 1:72b8490a4ece | 35 | write_data(Lf_add,wheel_LF); |
| st17099ng | 1:72b8490a4ece | 36 | write_data(Rb_add,wheel_RB); |
| st17099ng | 1:72b8490a4ece | 37 | write_data(Lb_add,wheel_LB); |
| st17099ng | 1:72b8490a4ece | 38 | write_data(Mot1add,arm_moter); |
| st17099ng | 1:72b8490a4ece | 39 | /* |
| st17099ng | 1:72b8490a4ece | 40 | pri("\033[2J"); |
| st17099ng | 1:72b8490a4ece | 41 | pri("\033[1;1H wheel_RF:0x%x",wheel_RF); |
| st17099ng | 1:72b8490a4ece | 42 | pri("\033[2;1H wheel_LF:0x%x",wheel_LF); |
| st17099ng | 1:72b8490a4ece | 43 | pri("\033[3;1H wheel_RB:0x%x",wheel_RB); |
| st17099ng | 1:72b8490a4ece | 44 | pri("\033[4;1H wheel_LB:0x%x",wheel_LB); |
| st17099ng | 1:72b8490a4ece | 45 | pri("\033[5;1H arm_moter:0x%x",arm_moter); |
| st17099ng | 1:72b8490a4ece | 46 | pri("\033[6;1H direct:%d",direct); |
| st17099ng | 1:72b8490a4ece | 47 | pri("\033[7;1H speed:%d",speed); |
| st17099ng | 1:72b8490a4ece | 48 | */ |
| st17099ng | 1:72b8490a4ece | 49 | |
| st17099ng | 0:bba4760cb391 | 50 | } |
| st17099ng | 0:bba4760cb391 | 51 | } |