
Lol smth
Dependencies: LocalPositionSystem MMA8451Q Motor_Driver Sensors mbed
Fork of TDP_main_BartFork by
main.cpp@5:2fc7bf0135d4, 2015-02-21 (annotated)
- Committer:
- Joseph_Penikis
- Date:
- Sat Feb 21 14:43:39 2015 +0000
- Revision:
- 5:2fc7bf0135d4
- Parent:
- 4:3aa9c1c734fe
- Child:
- 6:bea13722aae7
Early implementation (UNTESTED)
Who changed what in which revision?
User | Revision | Line number | New 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 | |
Reckstyle | 0:5ca0450111f3 | 23 | int main() { |
Joseph_Penikis | 5:2fc7bf0135d4 | 24 | |
Joseph_Penikis | 5:2fc7bf0135d4 | 25 | /* |
Joseph_Penikis | 5:2fc7bf0135d4 | 26 | Motor_Driver motors(PTD4, PTA12, PTA4, PTA5, PTC9, PTC8, PWM_PERIOD_US); |
Joseph_Penikis | 5:2fc7bf0135d4 | 27 | |
Joseph_Penikis | 5:2fc7bf0135d4 | 28 | motors.setSpeed(1.0f); |
Joseph_Penikis | 5:2fc7bf0135d4 | 29 | motors.forward(); |
Joseph_Penikis | 5:2fc7bf0135d4 | 30 | motors.start(); |
Joseph_Penikis | 5:2fc7bf0135d4 | 31 | |
Joseph_Penikis | 5:2fc7bf0135d4 | 32 | wait(3); |
Joseph_Penikis | 5:2fc7bf0135d4 | 33 | |
Joseph_Penikis | 5:2fc7bf0135d4 | 34 | motors.stop() |
Joseph_Penikis | 5:2fc7bf0135d4 | 35 | motors.reverse(); |
Joseph_Penikis | 5:2fc7bf0135d4 | 36 | wait(200ms); |
Joseph_Penikis | 5:2fc7bf0135d4 | 37 | |
Joseph_Penikis | 5:2fc7bf0135d4 | 38 | motors.start(); |
Joseph_Penikis | 5:2fc7bf0135d4 | 39 | */ |
Joseph_Penikis | 5:2fc7bf0135d4 | 40 | |
Joseph_Penikis | 5:2fc7bf0135d4 | 41 | sensor_initialise(); // initialise sensor values |
Joseph_Penikis | 5:2fc7bf0135d4 | 42 | wait(1); //give time to set up the system |
Reckstyle | 0:5ca0450111f3 | 43 | |
Reckstyle | 0:5ca0450111f3 | 44 | } |