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