Lol smth

Dependencies:   LocalPositionSystem MMA8451Q Motor_Driver Sensors mbed

Fork of TDP_main_BartFork by Yelfie

Committer:
Joseph_Penikis
Date:
Sun Feb 22 14:55:35 2015 +0000
Revision:
6:bea13722aae7
Parent:
5:2fc7bf0135d4
Child:
7:14af656b721f
ALL GLORY TO THE HYPNO-CODE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Joseph_Penikis 3:0274e082582e 1 // TESTING REPO COMMIT
Joseph_Penikis 3:0274e082582e 2
Reckstyle 2:e2adb7ab2947 3 /*
Reckstyle 2:e2adb7ab2947 4 ****** MAIN PROGRAM ******
Reckstyle 2:e2adb7ab2947 5
Reckstyle 2:e2adb7ab2947 6 TODO : organisational routine still to be decided.
Reckstyle 2:e2adb7ab2947 7 3 main approaches:
Reckstyle 2:e2adb7ab2947 8 -sequential prirority based tasks
Reckstyle 2:e2adb7ab2947 9 -Timer/Ticker driven with sequential prirority based tasks
Reckstyle 2:e2adb7ab2947 10 - interrupt driven from sensor inputs
Reckstyle 2:e2adb7ab2947 11
Reckstyle 2:e2adb7ab2947 12 Please consider that although it is an embedded envrionment we are NOT creating a HARD-TIME real time system - delays can be dealt with
Reckstyle 2:e2adb7ab2947 13 */
Reckstyle 2:e2adb7ab2947 14
Reckstyle 2:e2adb7ab2947 15
Reckstyle 2:e2adb7ab2947 16
Reckstyle 0:5ca0450111f3 17 #include "mbed.h"
Reckstyle 0:5ca0450111f3 18 #include "sensor_measure.h"
Joseph_Penikis 5:2fc7bf0135d4 19 #include "Motor_Driver.h"
Reckstyle 0:5ca0450111f3 20
Joseph_Penikis 5:2fc7bf0135d4 21 #define PWM_PERIOD_US 10000
Reckstyle 0:5ca0450111f3 22
Joseph_Penikis 6:bea13722aae7 23 // Pulses sets how many edges to detect before returning a time, max of 2^16, affectively refers to sample time
Joseph_Penikis 6:bea13722aae7 24 // Clock divider set by prescalar function where division value is 2^n
Joseph_Penikis 6:bea13722aae7 25 extern "C" void setup(int pulses, int prescalar);
Joseph_Penikis 6:bea13722aae7 26
Reckstyle 0:5ca0450111f3 27 int main() {
Joseph_Penikis 5:2fc7bf0135d4 28
Joseph_Penikis 5:2fc7bf0135d4 29 /*
Joseph_Penikis 5:2fc7bf0135d4 30 Motor_Driver motors(PTD4, PTA12, PTA4, PTA5, PTC9, PTC8, PWM_PERIOD_US);
Joseph_Penikis 5:2fc7bf0135d4 31
Joseph_Penikis 5:2fc7bf0135d4 32 motors.setSpeed(1.0f);
Joseph_Penikis 5:2fc7bf0135d4 33 motors.forward();
Joseph_Penikis 5:2fc7bf0135d4 34 motors.start();
Joseph_Penikis 5:2fc7bf0135d4 35
Joseph_Penikis 5:2fc7bf0135d4 36 wait(3);
Joseph_Penikis 5:2fc7bf0135d4 37
Joseph_Penikis 5:2fc7bf0135d4 38 motors.stop()
Joseph_Penikis 5:2fc7bf0135d4 39 motors.reverse();
Joseph_Penikis 5:2fc7bf0135d4 40 wait(200ms);
Joseph_Penikis 5:2fc7bf0135d4 41
Joseph_Penikis 5:2fc7bf0135d4 42 motors.start();
Joseph_Penikis 5:2fc7bf0135d4 43 */
Joseph_Penikis 6:bea13722aae7 44 setup(1000, 0);
Joseph_Penikis 5:2fc7bf0135d4 45
Joseph_Penikis 5:2fc7bf0135d4 46 sensor_initialise(); // initialise sensor values
Joseph_Penikis 5:2fc7bf0135d4 47 wait(1); //give time to set up the system
Reckstyle 0:5ca0450111f3 48
Reckstyle 0:5ca0450111f3 49 }