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:
- 22:c8e187b9d949
- Parent:
- 21:cb40c0533bc2
- Child:
- 23:4ddc4216f335
diff -r cb40c0533bc2 -r c8e187b9d949 source/main.cpp
--- a/source/main.cpp Thu Mar 02 20:07:41 2017 +0000
+++ b/source/main.cpp Fri Mar 03 20:44:01 2017 +0000
@@ -14,6 +14,11 @@
//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
@@ -30,17 +35,25 @@
-
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){
+ while(1){
sync_movement(false,true);
}
+
+
/* while(1){
if(status == 1){
led = 0;
@@ -56,3 +69,4 @@
}
+
