d

Dependencies:   mbed mbed

Files at this revision

API Documentation at this revision

Comitter:
beacon
Date:
Wed Mar 08 16:49:14 2017 +0000
Commit message:
l

Changed in this revision

Robot.cpp Show annotated file Show diff for this revision Revisions of this file
Robot.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
mbed.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robot.cpp	Wed Mar 08 16:49:14 2017 +0000
@@ -0,0 +1,29 @@
+#include "Robot.h"
+
+/* Work in progress -------------------------------------------- */
+
+Robot::Robot(PwmOut* left, PwmOut* right, DigitalOut* enableSignal){
+    this->powerSignal = enableSignal;
+    this->left = left;
+    this->right = right;
+    
+    this->left->period(0.00005f);
+    this->right->period(0.00005f);
+    }
+
+/* work in progress ------------------------------------------- */
+void Robot::drive(){
+	//pwm determine what direction it goes.
+    *powerSignal = 1;
+    *left = 0.5;
+    *right = 0.5;
+}
+
+//Remember to set 
+//DigitalOut powerMotor(PB_2) = 1;
+//DigitalIn errorMotor(PB_14);
+//if (errorMotor){
+	//reset
+//}
+
+//Add management for Overpower!! Pin PB_15
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robot.h	Wed Mar 08 16:49:14 2017 +0000
@@ -0,0 +1,27 @@
+#ifndef MOTORS_H
+#define MOTORS_H
+
+#include <cstdlib>
+#include <mbed.h>
+
+
+#include "mbed.h"
+
+/* Declarations for the Motors in the Robot in order to drive -------- */
+class Robot
+{
+public:
+    Robot(PwmOut* left, PwmOut* right, DigitalOut* enable);
+    void drive();
+
+private:
+    PwmOut*			left;
+    PwmOut*			right;
+
+    DigitalOut*		powerSignal;
+    DigitalIn*		errorSignal;
+    DigitalIn*		overtemperatur;
+
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 08 16:49:14 2017 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+#include "Robot.h"
+
+PwmOut			left(PA_8);
+PwmOut			right(PA_3);
+
+DigitalOut		powerSignal(PB_2);
+DigitalIn		errorSignal(PB_14);
+DigitalIn		overtemperatur(PB_15);
+
+Robot bot( &left, &right, &powerSignal);
+
+int main()
+{
+    bot.drive();
+
+    while( 1 ) {
+        wait(0.5f);
+    }
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Mar 08 16:49:14 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Wed Mar 08 16:49:14 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/gokmenascioglu/code/mbed/#a8fa94490a0a