Autor klase: Josip Lupinski

Revision:
0:a5f28c547fdb
diff -r 000000000000 -r a5f28c547fdb Mot_inter.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Mot_inter.cpp	Mon Feb 06 16:21:59 2017 +0000
@@ -0,0 +1,35 @@
+#include "Mot_inter.h"
+#include "mbed.h"
+
+Mot_inter::Mot_inter(PinName pin1, PinName pin2, PinName tipka1, PinName tipka2):C(tipka1),D(tipka2)
+{
+    A = new PwmOut(pin1);
+    B = new PwmOut(pin2);
+    C.mode(PullUp);
+    D.mode(PullUp);
+    C.rise(this, &Mot_inter::pritisnuto);
+    D.rise(this, &Mot_inter::pritisnuto);
+}
+
+void Mot_inter::naprijed()
+{
+    A->write(1);
+    B->write(0);
+}
+
+void Mot_inter::natrag()
+{
+    A->write(0);
+    B->write(1);
+}
+
+void Mot_inter::stop()
+{
+    A->write(0);
+    B->write(0);
+}
+
+void Mot_inter::pritisnuto()
+{
+    stop();
+}
\ No newline at end of file