Kiko Ishimoto
/
FourSicleRobot
4輪ロボットのプログラム
Revision 0:843dd155e1ed, committed 2016-08-07
- Comitter:
- kikoaac
- Date:
- Sun Aug 07 12:46:00 2016 +0000
- Commit message:
- 4???????????;
Changed in this revision
diff -r 000000000000 -r 843dd155e1ed Motor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Sun Aug 07 12:46:00 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/kikoaac/code/Motor/#3b639d84a95d
diff -r 000000000000 -r 843dd155e1ed main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Aug 07 12:46:00 2016 +0000 @@ -0,0 +1,43 @@ +#include "mbed.h" +#include "Motor.h" + +#define check() 1 +DigitalOut myled(LED1); +Serial pc(USBTX,USBRX); +Serial esp(p28,p27); +#define end "\r\n" + + +Motor motor[2] = {Motor(p20,p25,p19),Motor(p17,p18,p21)}; +int main() +{ + + pc.baud(115200); + esp.baud(115200); + int data = 0; + for(int i = 0 ;i < 2 ; i++)motor[i] = 0; + while(1) { + if(esp.readable()) { + data = esp.getc(); + } + printf("%d\r\n",data); + if(data == 1) + for(int i= 0; i< 2; i++) { + motor[i] = 1; + } + else if(data == 2) + for(int i= 0; i< 2; i++) { + motor[i] = -1; + } + else if(data == 3) { + motor[0] = 1; + motor[1] = -1; + } else if(data == 4) { + motor[0] = -1; + motor[1] = 1; + } else + for(int i= 0; i< 2; i++) { + motor[i] = 0; + } + } +}
diff -r 000000000000 -r 843dd155e1ed mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Aug 07 12:46:00 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file