Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Robocode by
Diff: source/main.cpp
- Revision:
- 27:df11ab63cda4
- Parent:
- 25:08ee4525155b
- Child:
- 29:e7d0208bf2af
diff -r 58f90fa8dbaf -r df11ab63cda4 source/main.cpp
--- a/source/main.cpp Sun Mar 05 17:11:17 2017 +0000
+++ b/source/main.cpp Mon Mar 06 15:10:24 2017 +0000
@@ -4,24 +4,14 @@
* Version 0.0.1
* PES2 Gruppe 1
**/
-/*
+
#include "mbed.h"
#include "pathfinding.h"
#include "time.h"
#include "IRsensor.h"
-#include "move.h"
-
-//static double time_counter = 0.0f;
-//static double deltatime = 0.0f;
+#include "movement.h"
+#include "EncoderCounter.h"
-InterruptIn EncoderLeftA(PB_6);
-InterruptIn EncoderLeftB(PB_7);
-InterruptIn EncoderRightA(PA_6);
-InterruptIn EncoderRightB(PC_7);
-
-DigitalIn encoder(PB_6);
-
-//DigitalOut led(LED1); // Board LED
//Perophery for distance sensors
AnalogIn distance(PB_1);
@@ -43,53 +33,12 @@
int main()
{
- //__enable_irq();
-
- EncoderLeftA.rise(&highPulseDetectedL);
- EncoderLeftB.rise(&highPulseDetectedL);
- EncoderRightA.rise(&highPulseDetectedR); // wird erkannt
- EncoderRightB.rise(&highPulseDetectedR); // wird erkannt
-
move_init();
while(1) {
- sync_movement(false,true);
-
+ sync_movement(false,true);
}
}
-*/
-
-#include "mbed.h"
-
-InterruptIn EncoderLeftA(PB_6);
-InterruptIn EncoderLeftB(PB_7);
-InterruptIn EncoderRightA(PA_6);
-InterruptIn EncoderRightB(PC_7);
-
-int EncoderCounterLeft = 0;
-int EncoderCounterRight = 0;
-void highPulseDetectedL()
-{
- EncoderCounterLeft += 1;
-}
-
-void highPulseDetectedR()
-{
- EncoderCounterRight += 1;
-}
-
-
-int main()
-{
- EncoderLeftA.rise(&highPulseDetectedL); // wird nicht erkannt
- EncoderLeftB.rise(&highPulseDetectedL); // wird nicht erkannt
- EncoderRightA.rise(&highPulseDetectedR); // wird erkannt
- EncoderRightB.rise(&highPulseDetectedR); // wird erkannt
-
- while(1) {
- printf("left: %d || right: %d\r\n",EncoderCounterLeft,EncoderCounterRight);
- }
-}
