Projet APP5 comm Zumo avec mbed
Dependencies: mbed PowerControl
main.cpp
- Committer:
- bouaziz
- Date:
- 2022-01-10
- Revision:
- 2:d5dd5e731d4a
- Parent:
- 1:e8c4e314d8f8
- Child:
- 3:f12fee4182d3
File content as of revision 2:d5dd5e731d4a:
#include "zumo.h"
#include "PowerControl/PowerControl.h"
DigitalOut myled(LED1);
zumo myzumo;
Timer t1;
long v1,v2;
int main() {
char v[3];
Peripheral_PowerDown(LPC1768_PCONP_PCENET|LPC1768_PCONP_PCSPI|LPC1768_PCONP_PCRTC|LPC1768_PCONP_PCI2C2|
LPC1768_PCONP_PCI2S|LPC1768_PCONP_PCQEI|LPC1768_PCONP_PCI2C1|LPC1768_PCONP_PCCAN1|LPC1768_PCONP_PCCAN2);
//and turn off the PHY OSC
LPC_GPIO1->FIODIR |= 0x8000000;
LPC_GPIO1->FIOCLR = 0x8000000;
wait(1.0);
t1.reset();
t1.start();
t1.stop();
printf("INIT= %u\r\n",t1.read_us());
t1.reset();
while(1) {
t1.start();
myzumo.speed(140,140);
t1.stop();
v1=t1.read_us();
wait(0.030);
t1.reset();
t1.start();
myzumo.stop();
t1.stop();
v2=t1.read_us();
printf("%u %u\r\n",v1,v2);
wait(.025);
}
}