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.
Fork of FYDP_Final2 by
motors.cpp
00001 #include "motors.h" 00002 00003 Motors::Motors(TB6612 * L, TB6612 * R, PinName STBY): 00004 Left(L), Right(R), enable(STBY) 00005 { 00006 enable = 1; 00007 } 00008 00009 void Motors::flip() 00010 { 00011 TB6612 * temp = Left; 00012 Left = Right; 00013 Right = temp; 00014 00015 Left->scale *= -1; 00016 Right->scale *= -1; 00017 } 00018 void Motors::reverse(bool m) 00019 { 00020 if(m) 00021 Right->scale *= -1; //reverse right motor 00022 else 00023 Left->scale *= -1; //reverse left motor 00024 } 00025 00026 //TODO: write in a function that automatically sets the motors to be oriented properly. Use the 00027 //gyroscopes and accelerometer to do this.
Generated on Tue Jul 12 2022 16:56:36 by
