Lol smth

Dependencies:   LocalPositionSystem MMA8451Q Motor_Driver Sensors mbed

Fork of TDP_main_BartFork by Yelfie

Committer:
Joseph_Penikis
Date:
Sun Feb 22 17:41:53 2015 +0000
Revision:
7:14af656b721f
Parent:
6:bea13722aae7
Child:
9:718987b106a8
Added Sensor measure implementation based off of assembly

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"
Joseph_Penikis 7:14af656b721f 20 #include "Sensors.h"
Reckstyle 0:5ca0450111f3 21
Joseph_Penikis 5:2fc7bf0135d4 22 #define PWM_PERIOD_US 10000
Reckstyle 0:5ca0450111f3 23
Joseph_Penikis 7:14af656b721f 24
Joseph_Penikis 6:bea13722aae7 25
Reckstyle 0:5ca0450111f3 26 int main() {
Joseph_Penikis 5:2fc7bf0135d4 27
Joseph_Penikis 5:2fc7bf0135d4 28 /*
Joseph_Penikis 5:2fc7bf0135d4 29 Motor_Driver motors(PTD4, PTA12, PTA4, PTA5, PTC9, PTC8, PWM_PERIOD_US);
Joseph_Penikis 5:2fc7bf0135d4 30
Joseph_Penikis 5:2fc7bf0135d4 31 motors.setSpeed(1.0f);
Joseph_Penikis 5:2fc7bf0135d4 32 motors.forward();
Joseph_Penikis 5:2fc7bf0135d4 33 motors.start();
Joseph_Penikis 5:2fc7bf0135d4 34
Joseph_Penikis 5:2fc7bf0135d4 35 wait(3);
Joseph_Penikis 5:2fc7bf0135d4 36
Joseph_Penikis 5:2fc7bf0135d4 37 motors.stop()
Joseph_Penikis 5:2fc7bf0135d4 38 motors.reverse();
Joseph_Penikis 5:2fc7bf0135d4 39 wait(200ms);
Joseph_Penikis 5:2fc7bf0135d4 40
Joseph_Penikis 5:2fc7bf0135d4 41 motors.start();
Joseph_Penikis 5:2fc7bf0135d4 42 */
Joseph_Penikis 7:14af656b721f 43 setup_counter(1000, 0);
Joseph_Penikis 7:14af656b721f 44 float frequency = measure_frequency(CHANNEL_1);
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 }