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: BEAR_Protocol_Edited BufferedSerial Debug MaxSonar PID Process QEI UI iSerial mbed
Fork of clean_V1 by
move.cpp
00001 #include "mbed.h" 00002 #include "move.h" 00003 00004 00005 00006 DigitalOut dir1(PC_10); 00007 DigitalOut dir2(PC_12); 00008 PwmOut speeds(PA_5); 00009 DigitalOut dirr1(PB_6); 00010 DigitalOut dirr2(PC_7); 00011 PwmOut speeds2(PA_7); 00012 DigitalOut relays(PA_8); 00013 void move:: movespeed_1(float setpoint,float spd) 00014 { 00015 double dc=0; 00016 if(setpoint>=0) 00017 { 00018 dir1=1; 00019 dir2=0; 00020 } 00021 else 00022 { 00023 dir1=0; 00024 dir2=1; 00025 } 00026 dc=setpoint+spd; 00027 speeds.write(dc); 00028 00029 00030 } 00031 void move:: movespeed_2(float setpoint,float spd) 00032 { 00033 double dc=0; 00034 if(setpoint>=0) 00035 { 00036 dirr1=1; 00037 dirr2=0; 00038 } 00039 else 00040 { 00041 dirr1=0; 00042 dirr2=1; 00043 } 00044 dc=setpoint+spd; 00045 speeds.write(dc); 00046 00047 00048 } 00049 void move::pump(int on_off) 00050 { 00051 relays=on_off; 00052 }
Generated on Tue Jul 12 2022 19:12:03 by
1.7.2
