AresENSEA-CDF2020
/
AresCDFMainCode_capteur_US
Capteur_US
main.cpp@14:dd3c756c6d48, 2020-09-16 (annotated)
- Committer:
- Nanaud
- Date:
- Wed Sep 16 12:31:54 2020 +0000
- Revision:
- 14:dd3c756c6d48
- Parent:
- 13:a72b0752aa6f
- Child:
- 16:4c0b1647e8ae
Odo 16.09.2020
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nanaud | 1:2fe8c402ee79 | 1 | // Nom du fichier : main.cpp |
Nanaud | 0:dc036b67c87c | 2 | #include "pins.h" |
Nanaud | 0:dc036b67c87c | 3 | |
Nanaud | 14:dd3c756c6d48 | 4 | void btnFct() |
Nanaud | 14:dd3c756c6d48 | 5 | { |
Nanaud | 6:ea6b30c4bb01 | 6 | mot_dis(); |
Nanaud | 6:ea6b30c4bb01 | 7 | aff_cd[0] = 0; |
Nanaud | 6:ea6b30c4bb01 | 8 | aff_cd[1] = 0; |
Nanaud | 14:dd3c756c6d48 | 9 | |
Nanaud | 6:ea6b30c4bb01 | 10 | pc.printf("comptG = %d\r\n",comptG); |
Nanaud | 6:ea6b30c4bb01 | 11 | pc.printf("comptD = %d\r\n",comptD); |
Nanaud | 6:ea6b30c4bb01 | 12 | bt.printf("comptG = %d\r\n",comptG); |
Nanaud | 6:ea6b30c4bb01 | 13 | bt.printf("comptD = %d\r\n",comptD); |
Nanaud | 6:ea6b30c4bb01 | 14 | } |
Nanaud | 6:ea6b30c4bb01 | 15 | |
Nanaud | 4:ad9b7355332e | 16 | int main() |
Nanaud | 4:ad9b7355332e | 17 | { |
Nanaud | 0:dc036b67c87c | 18 | pc.printf("\r\nAresCDFMainCode\r\n"); |
Nanaud | 4:ad9b7355332e | 19 | bt.printf("\r\nAresCDFMainCode\r\n"); |
Nanaud | 4:ad9b7355332e | 20 | |
Nanaud | 6:ea6b30c4bb01 | 21 | btn.rise(&btnFct); |
Nanaud | 6:ea6b30c4bb01 | 22 | |
Nanaud | 1:2fe8c402ee79 | 23 | // debug |
Nanaud | 1:2fe8c402ee79 | 24 | pc.attach(&serialIT); // Interruption liaison série |
Nanaud | 4:ad9b7355332e | 25 | bt.attach(&bluetoothIT); // Interruption bluetooth |
Nanaud | 6:ea6b30c4bb01 | 26 | pc.baud(9600); |
Nanaud | 6:ea6b30c4bb01 | 27 | pc.format(8,SerialBase::None,1); |
Nanaud | 6:ea6b30c4bb01 | 28 | bt.baud(9600); |
Nanaud | 6:ea6b30c4bb01 | 29 | bt.format(8,SerialBase::None,1); |
Nanaud | 6:ea6b30c4bb01 | 30 | |
Nanaud | 10:0714feaaaee1 | 31 | //ticker_US.attach(&captUS_trig,0.2); // On apelle cette fonction toutes 0.2 secondes |
Nanaud | 10:0714feaaaee1 | 32 | //ticker_affUS.attach(&affUltrasons,1.0); |
Nanaud | 14:dd3c756c6d48 | 33 | ticker_affcd.attach(&affCodeurs,1.0); |
Nanaud | 14:dd3c756c6d48 | 34 | //ticker_odo.attach(&odoGeonobot1,0.2); |
Nanaud | 14:dd3c756c6d48 | 35 | //ticker_affodo.attach(&affOdo,1.0); |
Nanaud | 4:ad9b7355332e | 36 | |
Nanaud | 1:2fe8c402ee79 | 37 | // Init capteurs à ultrasons |
Nanaud | 1:2fe8c402ee79 | 38 | captUS_init(); |
Nanaud | 0:dc036b67c87c | 39 | echo1.rise(&echoRise1); |
Nanaud | 0:dc036b67c87c | 40 | echo1.fall(&echoFall1); |
Nanaud | 0:dc036b67c87c | 41 | echo2.rise(&echoRise2); |
Nanaud | 0:dc036b67c87c | 42 | echo2.fall(&echoFall2); |
Nanaud | 0:dc036b67c87c | 43 | echo3.rise(&echoRise3); |
Nanaud | 0:dc036b67c87c | 44 | echo3.fall(&echoFall3); |
Nanaud | 0:dc036b67c87c | 45 | echo4.rise(&echoRise4); |
Nanaud | 0:dc036b67c87c | 46 | echo4.fall(&echoFall4); |
Nanaud | 0:dc036b67c87c | 47 | echo5.rise(&echoRise5); |
Nanaud | 0:dc036b67c87c | 48 | echo5.fall(&echoFall5); |
Nanaud | 0:dc036b67c87c | 49 | echo6.rise(&echoRise6); |
Nanaud | 0:dc036b67c87c | 50 | echo6.fall(&echoFall6); |
Nanaud | 4:ad9b7355332e | 51 | |
Nanaud | 1:2fe8c402ee79 | 52 | // Init DRV8825 |
Nanaud | 0:dc036b67c87c | 53 | drv_init(); |
Nanaud | 4:ad9b7355332e | 54 | |
Nanaud | 4:ad9b7355332e | 55 | // Init codeurs |
Nanaud | 0:dc036b67c87c | 56 | cdgA.rise(&cdgaRise); |
Nanaud | 6:ea6b30c4bb01 | 57 | cddA.rise(&cddaRise); |
Nanaud | 0:dc036b67c87c | 58 | cdgA.mode(PullUp); |
Nanaud | 6:ea6b30c4bb01 | 59 | cddA.mode(PullUp); |
Nanaud | 4:ad9b7355332e | 60 | |
Nanaud | 14:dd3c756c6d48 | 61 | while(1) { |
Nanaud | 14:dd3c756c6d48 | 62 | |
Nanaud | 14:dd3c756c6d48 | 63 | } |
Nanaud | 0:dc036b67c87c | 64 | } |