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.
Sophia.cpp
00001 #include "mbed.h" 00002 #include "Motor.h" 00003 #include "Sophia.h" 00004 00005 Motor motor_right(PTD4, PTC13, PTC12); // pwm, fwd, rev 00006 Motor motor_left(PTD4, PTA13, PTD5); 00007 00008 void Sophia::move(float speed, int direction) { 00009 if(direction) { 00010 motor_right.speed(speed); 00011 motor_left.speed(speed); 00012 } 00013 else { 00014 motor_right.speed(-speed); 00015 motor_left.speed(-speed); 00016 } 00017 } 00018 00019 void Sophia::turn(float speed, int direction) { 00020 if(direction) { 00021 motor_right.speed(0.0); 00022 motor_left.speed(speed); 00023 } 00024 else { 00025 motor_right.speed(speed); 00026 motor_left.speed(0.0); 00027 } 00028 } 00029 void Sophia::spin(float speed, int direction) { 00030 if(direction) { 00031 motor_right.speed(-speed); 00032 motor_left.speed(speed); 00033 } 00034 else { 00035 motor_right.speed(speed); 00036 motor_left.speed(-speed); 00037 } 00038 }
Generated on Tue Jul 12 2022 22:55:22 by
1.7.2