Projet APP5 comm Zumo avec mbed

Dependencies:   mbed PowerControl

Committer:
bouaziz
Date:
Mon Jan 10 08:59:56 2022 +0000
Revision:
2:d5dd5e731d4a
Parent:
1:e8c4e314d8f8
Child:
3:f12fee4182d3
test Polytech paris saclay;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bouaziz 1:e8c4e314d8f8 1 #include "zumo.h"
bouaziz 0:fd4714227d8e 2 #include "PowerControl/PowerControl.h"
bouaziz 0:fd4714227d8e 3
bouaziz 0:fd4714227d8e 4 DigitalOut myled(LED1);
bouaziz 1:e8c4e314d8f8 5 zumo myzumo;
bouaziz 2:d5dd5e731d4a 6 Timer t1;
bouaziz 2:d5dd5e731d4a 7 long v1,v2;
bouaziz 0:fd4714227d8e 8
bouaziz 0:fd4714227d8e 9 int main() {
bouaziz 0:fd4714227d8e 10 char v[3];
bouaziz 0:fd4714227d8e 11 Peripheral_PowerDown(LPC1768_PCONP_PCENET|LPC1768_PCONP_PCSPI|LPC1768_PCONP_PCRTC|LPC1768_PCONP_PCI2C2|
bouaziz 0:fd4714227d8e 12 LPC1768_PCONP_PCI2S|LPC1768_PCONP_PCQEI|LPC1768_PCONP_PCI2C1|LPC1768_PCONP_PCCAN1|LPC1768_PCONP_PCCAN2);
bouaziz 0:fd4714227d8e 13 //and turn off the PHY OSC
bouaziz 1:e8c4e314d8f8 14 LPC_GPIO1->FIODIR |= 0x8000000;
bouaziz 1:e8c4e314d8f8 15 LPC_GPIO1->FIOCLR = 0x8000000;
bouaziz 1:e8c4e314d8f8 16 wait(1.0);
bouaziz 2:d5dd5e731d4a 17 t1.reset();
bouaziz 2:d5dd5e731d4a 18 t1.start();
bouaziz 2:d5dd5e731d4a 19 t1.stop();
bouaziz 2:d5dd5e731d4a 20 printf("INIT= %u\r\n",t1.read_us());
bouaziz 2:d5dd5e731d4a 21 t1.reset();
bouaziz 2:d5dd5e731d4a 22
bouaziz 1:e8c4e314d8f8 23 while(1) {
bouaziz 2:d5dd5e731d4a 24 t1.start();
bouaziz 1:e8c4e314d8f8 25 myzumo.speed(140,140);
bouaziz 2:d5dd5e731d4a 26 t1.stop();
bouaziz 2:d5dd5e731d4a 27 v1=t1.read_us();
bouaziz 2:d5dd5e731d4a 28 wait(0.030);
bouaziz 2:d5dd5e731d4a 29 t1.reset();
bouaziz 2:d5dd5e731d4a 30 t1.start();
bouaziz 1:e8c4e314d8f8 31 myzumo.stop();
bouaziz 2:d5dd5e731d4a 32 t1.stop();
bouaziz 2:d5dd5e731d4a 33 v2=t1.read_us();
bouaziz 2:d5dd5e731d4a 34 printf("%u %u\r\n",v1,v2);
bouaziz 2:d5dd5e731d4a 35 wait(.025);
bouaziz 0:fd4714227d8e 36
bouaziz 0:fd4714227d8e 37 }
bouaziz 0:fd4714227d8e 38 }