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 "dc_motor.hpp" 00003 00004 int main () 00005 { 00006 AnalogIn vert(p20); 00007 AnalogIn horz(p19); 00008 DC_motor m_sx(p21, p22); 00009 DC_motor m_dx(p23, p24); 00010 00011 while(1) { 00012 wait(0.2); 00013 float v = vert.read(); 00014 float h = horz.read(); 00015 float speed_sx = (v-0.5)*2.0; 00016 if (h>0.5) 00017 speed_sx *= (1.0-(h-0.5)*2.0); 00018 float speed_dx = (v-0.5)*2.0; 00019 if (h<0.5) 00020 speed_dx *= ((h+0.5)*2.0-1.0); 00021 m_sx.speed(speed_sx); 00022 m_dx.speed(speed_dx); 00023 // printf("VERT(%f), HORZ(%f), sx(%f), dx(%f)\n\r", 00024 // vert.read(), horz.read(), speed_sx, speed_dx); 00025 } 00026 }
Generated on Mon Jul 18 2022 03:47:11 by
1.7.2