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
source/main.cpp
- Committer:
- cittecla
- Date:
- 2017-03-03
- Revision:
- 22:c8e187b9d949
- Parent:
- 21:cb40c0533bc2
- Child:
- 23:4ddc4216f335
File content as of revision 22:c8e187b9d949:
/**
* Main File of Robocode
* Handels parallel processing and interupts
* 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;
InterruptIn EncoderLeftA(PB_6);
InterruptIn EncoderLeftB(PB_7);
InterruptIn EncoderRightA(PA_6);
InterruptIn EncoderRightB(PC_7);
//DigitalOut led(LED1); // Board LED
//Perophery for distance sensors
AnalogIn distance(PB_1);
DigitalOut enable(PC_1);
DigitalOut bit0(PH_1);
DigitalOut bit1(PC_2);
DigitalOut bit2(PC_3);
IRSensor sensors[6];
//indicator leds arround robot
DigitalOut leds[] = { PC_8, PC_6, PB_12, PA_7, PC_0, PC_9 };
static double time_counter = 0.0f;
static double timer0 = 0.0f;
bool status = 0;
int main()
{
__enable_irq();
EncoderLeftA.rise(&highPulseDetectedL);
EncoderLeftB.rise(&highPulseDetectedL);
EncoderRightA.rise(&highPulseDetectedR);
EncoderRightB.rise(&highPulseDetectedR);
move_init();
while(1){
sync_movement(false,true);
}
/* while(1){
if(status == 1){
led = 0;
wait(0.5);
status = 0;
}else{
led = 1;
timer0 = 0.0f;
pathfinding();
status = 1;
}
}*/
}
