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
Diff: move.cpp
- Revision:
- 1:45f1573d65a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/move.cpp Mon Mar 21 20:21:12 2016 +0000
@@ -0,0 +1,52 @@
+#include "mbed.h"
+#include "move.h"
+
+
+
+DigitalOut dir1(PC_10);
+DigitalOut dir2(PC_12);
+PwmOut speeds(PA_5);
+DigitalOut dirr1(PB_6);
+DigitalOut dirr2(PC_7);
+PwmOut speeds2(PA_7);
+DigitalOut relays(PA_8);
+ void move:: movespeed_1(float setpoint,float spd)
+{
+ double dc=0;
+ if(setpoint>=0)
+ {
+ dir1=1;
+ dir2=0;
+ }
+ else
+ {
+ dir1=0;
+ dir2=1;
+ }
+ dc=setpoint+spd;
+ speeds.write(dc);
+
+
+}
+void move:: movespeed_2(float setpoint,float spd)
+{
+ double dc=0;
+ if(setpoint>=0)
+ {
+ dirr1=1;
+ dirr2=0;
+ }
+ else
+ {
+ dirr1=0;
+ dirr2=1;
+ }
+ dc=setpoint+spd;
+ speeds.write(dc);
+
+
+}
+void move::pump(int on_off)
+{
+ relays=on_off;
+}
\ No newline at end of file
