Projet APP5 comm Zumo avec mbed
Dependencies: mbed PowerControl
main.cpp@3:f12fee4182d3, 2022-01-10 (annotated)
- Committer:
- bouaziz
- Date:
- Mon Jan 10 23:02:27 2022 +0000
- Revision:
- 3:f12fee4182d3
- Parent:
- 2:d5dd5e731d4a
suite programme ajout fonctions
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:f12fee4182d3 | 8 | unsigned short i; |
bouaziz | 3:f12fee4182d3 | 9 | int meandist; |
bouaziz | 0:fd4714227d8e | 10 | int main() { |
bouaziz | 0:fd4714227d8e | 11 | char v[3]; |
bouaziz | 0:fd4714227d8e | 12 | Peripheral_PowerDown(LPC1768_PCONP_PCENET|LPC1768_PCONP_PCSPI|LPC1768_PCONP_PCRTC|LPC1768_PCONP_PCI2C2| |
bouaziz | 0:fd4714227d8e | 13 | LPC1768_PCONP_PCI2S|LPC1768_PCONP_PCQEI|LPC1768_PCONP_PCI2C1|LPC1768_PCONP_PCCAN1|LPC1768_PCONP_PCCAN2); |
bouaziz | 0:fd4714227d8e | 14 | //and turn off the PHY OSC |
bouaziz | 1:e8c4e314d8f8 | 15 | LPC_GPIO1->FIODIR |= 0x8000000; |
bouaziz | 1:e8c4e314d8f8 | 16 | LPC_GPIO1->FIOCLR = 0x8000000; |
bouaziz | 1:e8c4e314d8f8 | 17 | wait(1.0); |
bouaziz | 2:d5dd5e731d4a | 18 | t1.reset(); |
bouaziz | 2:d5dd5e731d4a | 19 | t1.start(); |
bouaziz | 2:d5dd5e731d4a | 20 | t1.stop(); |
bouaziz | 3:f12fee4182d3 | 21 | //printf("INIT= %u\r\n",t1.read_us()); |
bouaziz | 2:d5dd5e731d4a | 22 | t1.reset(); |
bouaziz | 3:f12fee4182d3 | 23 | myled=0; |
bouaziz | 2:d5dd5e731d4a | 24 | |
bouaziz | 1:e8c4e314d8f8 | 25 | while(1) { |
bouaziz | 3:f12fee4182d3 | 26 | myzumo.speed(140,140); |
bouaziz | 3:f12fee4182d3 | 27 | do{ |
bouaziz | 3:f12fee4182d3 | 28 | myzumo.read_data_wait(DATA_SENSOR_MEANDIST, (char*)&meandist); |
bouaziz | 3:f12fee4182d3 | 29 | }while(meandist<50); |
bouaziz | 1:e8c4e314d8f8 | 30 | myzumo.stop(); |
bouaziz | 3:f12fee4182d3 | 31 | myled=1; |
bouaziz | 3:f12fee4182d3 | 32 | while(1); |
bouaziz | 0:fd4714227d8e | 33 | } |
bouaziz | 0:fd4714227d8e | 34 | } |