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.
Dependencies: mbed
right_motor.cpp
00001 #include "right_motor.h" 00002 PwmOut motor_channelA(PB_9); 00003 PwmOut motor_channelB(PB_8); 00004 00005 RightMotor::RightMotor() { 00006 00007 motor_channelA.period_us(50); 00008 motor_channelB.period_us(50); 00009 } 00010 00011 //Sets motor speed 00012 void RightMotor::speed(float speed) { 00013 00014 if(speed < 0.0f){ 00015 motor_channelA.write(-speed/100); 00016 motor_channelB.write(0); 00017 } 00018 else{ 00019 motor_channelB.write(speed/100); 00020 motor_channelA.write(0); 00021 } 00022 } 00023 00024 //void RightMotor::set_period(float period) { 00025 // motor_right_sig.period(period); 00026 //} 00027 00028 //Sets motor speed to 0 00029 void RightMotor::stop() { 00030 00031 motor_channelB.write(0); 00032 motor_channelA.write(0); 00033 }
Generated on Thu Jul 14 2022 05:30:38 by
