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.
main.cpp
00001 #include "mbed.h" 00002 #include "Motor.h" 00003 00004 #define check() 1 00005 DigitalOut myled(LED1); 00006 Serial pc(USBTX,USBRX); 00007 Serial esp(p28,p27); 00008 #define end "\r\n" 00009 00010 00011 Motor motor[2] = {Motor(p20,p25,p19),Motor(p17,p18,p21)}; 00012 int main() 00013 { 00014 00015 pc.baud(115200); 00016 esp.baud(115200); 00017 int data = 0; 00018 for(int i = 0 ;i < 2 ; i++)motor[i] = 0; 00019 while(1) { 00020 if(esp.readable()) { 00021 data = esp.getc(); 00022 } 00023 printf("%d\r\n",data); 00024 if(data == 1) 00025 for(int i= 0; i< 2; i++) { 00026 motor[i] = 1; 00027 } 00028 else if(data == 2) 00029 for(int i= 0; i< 2; i++) { 00030 motor[i] = -1; 00031 } 00032 else if(data == 3) { 00033 motor[0] = 1; 00034 motor[1] = -1; 00035 } else if(data == 4) { 00036 motor[0] = -1; 00037 motor[1] = 1; 00038 } else 00039 for(int i= 0; i< 2; i++) { 00040 motor[i] = 0; 00041 } 00042 } 00043 }
Generated on Fri Jul 22 2022 21:10:06 by
1.7.2